@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Caslon+Display&display=swap');

:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --ink: #263b36;
  --muted: #77817a;
  --orange: #d9693e;
  --line: #e1e3d9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 52px 38px 32px;
}

header {
  max-width: 660px;
  margin-bottom: 32px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted);
}

h1 {
  font-family: 'Libre Caslon Display', Georgia, serif;
  font-size: 66px;
  font-weight: 400;
  letter-spacing: -2px;
  line-height: 1.05;
  margin: 15px 0;
}

h1 span {
  color: var(--orange);
}

header p {
  font-size: 15px;
  line-height: 1.7;
  color: #69766d;
  max-width: 590px;
}

.explorer {
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 26px 24px;
  box-shadow: 0 8px 30px #293b3610;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

button {
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}

.modes {
  display: flex;
  gap: 3px;
  background: #f0f1eb;
  padding: 4px;
  border-radius: 8px;
}

.modes button {
  border: 0;
  background: transparent;
  border-radius: 5px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
}

.modes button.selected {
  background: #fffefa;
  box-shadow: 0 1px 5px #283c351a;
}

.reset {
  border: 0;
  background: transparent;
  font-size: 12px;
  color: #6d786f;
}

.maps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 23px;
}

.map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

h2 span {
  font-size: 10px;
  color: #8b958b;
  margin-right: 9px;
}

.small {
  font-size: 8px;
  letter-spacing: 1.1px;
  color: #8b958b;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  touch-action: none;
}

#editor {
  cursor: grab;
}

.caption {
  font-size: 10px;
  color: #7b8277;
  min-height: 28px;
  line-height: 1.6;
  margin: 0 0 12px;
}

.orange-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--orange);
  border-radius: 50%;
  margin-right: 5px;
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding: 19px 0;
  font-size: 11px;
}

.controls > label {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type=range] {
  width: 120px;
  accent-color: var(--orange);
}

output {
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  color: #758174;
}

details {
  margin-left: auto;
  position: relative;
}

summary {
  cursor: pointer;
  color: #748173;
}

.precise {
  position: absolute;
  right: 0;
  top: 25px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  width: 285px;
  z-index: 2;
  box-shadow: 0 5px 20px #0001;
}

.precise p {
  line-height: 1.5;
  margin-top: 0;
}

#corner-inputs > div {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 7px 0;
}

#corner-inputs input {
  width: 70px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.nudge {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.nudge button {
  background: #f0f1eb;
  border: 0;
  padding: 5px 10px;
  border-radius: 4px;
}

.equation-panel {
  border: 1px solid #e3e6dc;
  background: #f5f6f0;
  border-radius: 8px;
  padding: 18px 20px;
}

.equation-title, .equation-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.equation-title .eyebrow {
  font-size: 9px;
}

#status {
  color: #43765c;
  background: #e6eee3;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 10px;
}

#status.bad {
  background: #f7e4d9;
  color: #a45734;
}

.equation {
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1.8;
  margin: 12px 0;
  overflow-wrap: anywhere;
}

.equation-footer {
  color: #81897c;
  font-size: 10px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  margin: 26px 6px 0;
}

h3 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 17px;
  margin: 0 0 8px;
}

footer p {
  font-size: 12px;
  line-height: 1.8;
  color: #7b847a;
  margin: 0;
}

strong {
  font-weight: 500;
  color: #40584b;
}

button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  main {
    padding: 28px 16px;
  }

  h1 {
    font-size: 48px;
  }

  .explorer {
    padding: 16px;
  }

  .maps {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .controls {
    gap: 14px;
  }

  .controls > label {
    gap: 8px;
  }

  input[type=range] {
    width: 100px;
  }

  details {
    margin-left: 0;
  }

  .precise {
    left: 0;
    right: auto;
  }

  .equation {
    font-size: 17px;
  }

  .equation-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  footer {
    gap: 20px;
    grid-template-columns: 1fr;
  }

  .small {
    font-size: 8px;
  }

}

@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background .15s;
  }

}
