/* The demo page: a planning board. Colour is kept for the candidates on the
   board; everything around it stays quiet. No font or file is fetched from
   another site: nothing leaves the browser. */

:root {
  --paper: #eef2ef;
  --panel: #ffffff;
  --ink: #1d2b36;
  --muted: #56656f;
  --line: #cbd5cf;
  --accent: #2f6f62;
  --accent-ink: #ffffff;
  --error: #a3342b;
  --error-paper: #f8e9e6;
  --candidate-0: #2f6da8;
  --candidate-1: #b2456e;
  --candidate-2: #3c8a5c;
  --candidate-3: #a0661a;
  --candidate-4: #6e4fa0;
  --candidate-5: #1f7f84;
  --candidate-6: #8a5a34;
  --candidate-7: #56677a;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12191e;
    --panel: #1a242b;
    --ink: #e4ebee;
    --muted: #9aaab3;
    --line: #2c3a42;
    --accent: #5fb3a0;
    --accent-ink: #0e1a17;
    --error: #f09a8f;
    --error-paper: #3a2220;
    color-scheme: dark;
  }
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

/* ---------- masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2rem clamp(1rem, 4vw, 3rem) 1.25rem;
}

.masthead h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tagline {
  margin: 0.4rem 0 0;
  font-size: 1.15rem;
  max-width: 40em;
}

.privacy {
  margin: 0.25rem 0 0;
  color: var(--muted);
  max-width: 48em;
}

.masthead-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.languages {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.languages button {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0.3rem 0.8rem;
}

.languages button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- workspace */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.25rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  align-items: start;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  min-width: 0;
}

.pane h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.label {
  display: block;
  font-weight: 650;
  margin: 1rem 0 0.25rem;
}

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

button,
select,
input[type="date"],
.file-button {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
}

button,
.file-button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

.examples .label {
  margin-top: 0;
}

.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.example-list button {
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
}

.example-list button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.code {
  font: 14px/1.5 var(--mono);
  tab-size: 2;
}

textarea.code {
  display: block;
  width: 100%;
  min-height: 26rem;
  resize: vertical;
  padding: 0.75rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre;
}

textarea.code.short {
  min-height: 9rem;
}

.start {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.start summary,
.objectives summary,
.charts summary,
.output summary {
  cursor: pointer;
  font-weight: 650;
}

.start[open] summary,
.objectives[open] summary,
.charts[open] summary {
  margin-bottom: 0.5rem;
}

/* ---------- the objectives chosen in the page */

.objectives {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.objective-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.75rem;
}

.objective {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.3rem;
  border-radius: 0.3rem;
}

.objective.is-chosen {
  background: var(--paper);
}

.objective .check {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.objective code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

button.move {
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
}

/* ---------- the curves of the objectives */

.charts {
  margin: 0.5rem 0;
}

.chart-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
}

.chart {
  margin: 0;
}

.chart figcaption {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.chart .chart-name {
  color: var(--muted);
}

.chart svg {
  width: 100%;
  height: 3.5rem;
  background: var(--paper);
  border-radius: 0.3rem;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-button:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.check,
.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 1rem 0 0;
}

.run {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.25rem;
}

.period-help {
  margin-top: 0.5rem;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

button.primary {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.7rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

button.primary.is-stop {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--ink);
}

/* ---------- schedule */

.status {
  margin: 0 0 1rem;
  font-weight: 600;
}

.status.is-searching::before {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.status.is-failed {
  color: var(--error);
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status.is-searching::before {
    animation: none;
  }
}

.message.error {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--error);
  background: var(--error-paper);
  border-radius: 0 8px 8px 0;
}

.notes {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.day + .day {
  margin-top: 1.5rem;
}

.day h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.day h3::first-letter {
  text-transform: uppercase;
}

.day-scroll {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.day-grid {
  display: grid;
  grid-template-columns: max-content minmax(calc(var(--hours) * 3.5rem), 1fr);
  column-gap: 0.75rem;
  row-gap: 0.35rem;
  align-items: center;
}

@media (max-width: 600px) {
  .day-grid {
    grid-template-columns: max-content minmax(calc(var(--hours) * 5rem), 1fr);
  }
}

.scale {
  position: relative;
  height: 1.3rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}

.scale span:first-child {
  transform: none;
}

.scale span:last-child {
  transform: translateX(-100%);
}

.person {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.track {
  position: relative;
  height: 2.2rem;
  border-radius: 6px;
  background-color: var(--paper);
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--hours)) 100%;
}

.strip {
  position: absolute;
  top: 0.2rem;
  bottom: 0.2rem;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  overflow: hidden;
  border-radius: 5px;
  background-color: var(--strip);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25);
}

.strip.is-fixed {
  background-image: repeating-linear-gradient(135deg, rgb(255 255 255 / 0.22) 0 5px, transparent 5px 10px);
}

.empty {
  color: var(--muted);
}

.summary {
  margin: 1rem 0 0;
  font-weight: 600;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.downloads span {
  color: var(--muted);
}

.output {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.output pre {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  overflow-x: auto;
  background: var(--paper);
  border-radius: 8px;
}

/* A schedule is a table and must keep its columns, so it scrolls sideways.
   A -check report is prose, and sideways is where a phone loses it: a line
   nobody scrolls to is a line nobody reads, so the report wraps instead. */
.output pre.prose {
  overflow-x: visible;
  white-space: pre-wrap;
}

/* ---------- a problem, an idea */

.contact {
  padding: 2rem clamp(1rem, 4vw, 3rem) 0;
  max-width: 60rem;
}

.contact h2 {
  font-size: 1.1rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.case-link {
  width: 100%;
  margin-top: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
}

/* ---------- limits */

.limits {
  padding: 2rem clamp(1rem, 4vw, 3rem) 3rem;
  max-width: 60rem;
}

.limits h2 {
  font-size: 1.1rem;
}

.limits ul {
  padding-left: 1.2rem;
  color: var(--muted);
}

.limits .links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.limits .release {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}
