@font-face {
  font-family: Matter;
  src: url('assets/matter.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: Teodor;
  src: url('assets/teodor.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Matter Mono';
  src: url('assets/matter-mono.otf') format('opentype');
  font-display: swap;
}
:root {
  --ink: #171717;
  --rule: #d0d0d0;
  --secondary: #5a5a5a;
  --mono: 'Matter Mono', monospace;
  font-family: Matter, Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.masthead {
  height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 30px;
  border-bottom: 1px solid var(--ink);
}
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { display: block; width: 237px; max-width: 61vw; height: auto; }
.edition, .preview-heading { font: 11px var(--mono); letter-spacing: .015em; }
.edition { white-space: nowrap; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(284px, 26vw, 380px);
  min-height: calc(100vh - 67px);
}
.preview {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 21px 30px 29px;
  background: #f6f5f4;
}
.preview-heading { display: flex; justify-content: space-between; gap: 5px; color: var(--secondary); }
.stage { display: grid; place-items: center; flex: 1; padding: 30px 27px 5px; }
.sheet {
  position: relative;
  width: min(100%, max(200px, calc((100svh - 180px) * var(--paper-ratio, .72664))));
  aspect-ratio: var(--paper-ratio, .72664);
  background: #fff;
}
#poster, #poster > svg { display: block; width: 100%; height: 100%; }
.loading { margin: 0; padding: 19px; font: 12px var(--mono); }
.crop { position: absolute; width: 0; height: 0; pointer-events: none; }
.crop::before, .crop::after { content: ''; position: absolute; background: currentColor; }
.crop::before { width: .5px; height: 18px; }
.crop::after { width: 18px; height: .5px; }
.crop-tl { top: 0; left: 0; }
.crop-tr { top: 0; right: 0; }
.crop-bl { bottom: 0; left: 0; }
.crop-br { bottom: 0; right: 0; }
.crop-tl::before, .crop-tr::before { bottom: 8px; }
.crop-bl::before, .crop-br::before { top: 8px; }
.crop-tl::before, .crop-bl::before { left: 0; }
.crop-tr::before, .crop-br::before { right: 0; }
.crop-tl::after, .crop-bl::after { right: 8px; }
.crop-tr::after, .crop-br::after { left: 8px; }
.crop-tl::after, .crop-tr::after { top: 0; }
.crop-bl::after, .crop-br::after { bottom: 0; }

.editor { display: grid; align-content: center; border-left: 1px solid var(--ink); padding: 27px; }
.editor-body { width: 100%; margin: 0 auto; }
.text-control { display: grid; gap: 8px; }
textarea {
  display: block;
  width: 100%;
  min-height: 148px;
  padding: 10px 11px;
  background: #f6f5f4;
  border: 1px solid var(--rule);
  border-radius: 0;
  resize: none;
  font: 15px/1.3 Teodor, Georgia, serif;
}
#word-count { justify-self: end; color: var(--secondary); font: 11px var(--mono); }
.fragment-control { display: grid; justify-items: center; padding: 14px 0 16px; }
.dial {
  position: relative;
  width: min(100%, 178px);
  aspect-ratio: 1;
  margin: 2px 0 3px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 50%;
  color: white;
}
.dial:active { cursor: grabbing; }
.dial svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.dial-face, .dial-indicator { fill: var(--ink); }
.dial-track, .dial-progress, .dial-ticks { fill: none; stroke-linecap: round; }
.dial-track { stroke: #d9d9d9; stroke-width: 2; }
.dial-progress { stroke: var(--ink); stroke-width: 2; }
.dial-ticks { stroke: #7f7f7f; stroke-width: .75; }
.dial-ticks .major { stroke: var(--ink); stroke-width: 1; }
.dial-value, .dial-end { position: absolute; pointer-events: none; font-family: var(--mono); }
.dial-value { inset: 0; display: grid; place-items: center; font-size: 27px; letter-spacing: -.045em; }
.dial-end { color: var(--secondary); font-size: 9px; bottom: 15px; }
.dial-min { left: 39px; }
.dial-max { right: 35px; }
.shuffle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #fff;
}
.shuffle:hover { color: white; background: var(--ink); }
.formats { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.formats button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  align-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
  padding: 8px 12px;
  font: 13px var(--mono);
}
.formats button:hover:not(:disabled) { color: var(--ink); background: #fff; }
.formats button:disabled { opacity: .5; }
#status { margin: 8px 0 0; color: var(--secondary); font-size: 12px; }
#status:empty { display: none; }
@media (max-width: 850px) {
  .editor, .preview, .masthead { padding-inline: 20px; }
}
@media (max-width: 680px) {
  .masthead { height: 54px; padding-inline: 14px; }
  .brand img { width: 186px; }
  .workspace { grid-template-columns: 1fr; min-height: calc(100svh - 54px); }
  .preview { padding: 13px 17px 30px; border-bottom: 1px solid var(--ink); }
  .stage { padding: 28px 26px 4px; }
  .sheet { width: min(100%, max(206px, calc(49svh * var(--paper-ratio, .72664)))); }
  .editor { border-left: 0; padding: 20px 17px 26px; }
  .editor-body { max-width: 400px; }
}
