:root {
  --paper: #f3eee4;
  --paper-2: #e8e0d2;
  --ink: #1c1915;
  --ink-soft: #5c564c;
  --rule: #c9bfb0;
  --accent: #b42318;
  --accent-ink: #fffaf6;
  --frame: #fffdf8;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 16px;
  top: 16px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  z-index: 2;
}

.mast,
main,
.colophon {
  width: min(1080px, calc(100% - 40px));
  margin-inline: auto;
}

.mast {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 28px 0 8px;
  border-bottom: 1px solid var(--rule);
}

.mark,
.kicker {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

.kicker {
  color: var(--ink-soft);
}

.hero {
  padding: 48px 0 28px;
  max-width: 38rem;
}

h1,
h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  line-height: 1.08;
}

.lede {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.8fr);
  gap: 28px;
  padding-bottom: 48px;
}

.plate {
  position: relative;
  min-height: 380px;
  background: var(--frame);
  border: 1px solid var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
}

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

.plate.is-hot {
  background: var(--paper-2);
}

.crop {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
  pointer-events: none;
}

.crop.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.crop.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.crop.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.crop.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.empty {
  text-align: center;
  padding: 32px;
  max-width: 26rem;
}

.empty-title {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.6rem;
  margin: 0 0 8px;
}

.empty-copy {
  margin: 0 0 20px;
  color: var(--ink-soft);
}

.empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.preview-in {
  max-width: calc(100% - 48px);
  max-height: 420px;
  object-fit: contain;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.temps {
  border: 1px solid var(--rule);
  margin: 0;
  padding: 12px 14px 6px;
}

.temps legend {
  padding: 0 6px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  cursor: pointer;
}

.choice + .choice {
  border-top: 1px solid var(--rule);
}

.choice strong {
  display: block;
}

.choice small {
  color: var(--ink-soft);
}

.ghost,
.go {
  font: inherit;
  cursor: pointer;
  border-radius: 0;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 8px 14px;
}

.ghost:hover,
.go:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.go {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  padding: 14px 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.go:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  min-height: 1.5em;
  margin: 0;
  color: var(--accent);
}

.caps {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
}

.caps div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.caps dt {
  color: var(--ink-soft);
  font-weight: 500;
}

.caps dd {
  margin: 0;
}

.result {
  border-top: 1px solid var(--ink);
  padding: 36px 0 64px;
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 20px;
  margin-bottom: 20px;
}

.result-head h2 {
  margin: 0;
  flex: 1;
}

.progress {
  margin: 0;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

.preview-out,
.source {
  margin: 0;
}

.preview-out figcaption,
.source-label {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.frame {
  min-height: 320px;
  background: repeating-conic-gradient(#ece6da 0% 25%, #fffdf8 0% 50%) 50% / 24px 24px;
  border: 1px solid var(--rule);
  display: grid;
  place-items: center;
  padding: 16px;
}

.frame img {
  max-width: 100%;
  max-height: 420px;
  background: white;
}

.placeholder {
  margin: 0;
  color: var(--ink-soft);
  text-align: center;
  max-width: 16rem;
}

.source-pre {
  margin: 0;
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  background: var(--ink);
  color: #f3eee4;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

.colophon {
  border-top: 1px solid var(--rule);
  padding: 24px 0 48px;
  color: var(--ink-soft);
  font-size: 14px;
}

.colophon a {
  color: var(--ink);
}

kbd {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.85em;
  border: 1px solid var(--rule);
  padding: 0 4px;
}

@media (max-width: 800px) {
  .stage,
  .split {
    grid-template-columns: 1fr;
  }

  .plate {
    min-height: 280px;
  }
}
