/* DOKUMA — chrome made of the engine's own dyes. Straight, still lines;
   the only decorative thing on the page is the cloth. */
:root {
  --ground: #e9dfc6;      /* undyed cream */
  --ink: #2c2a25;         /* iron black */
  --accent: #a23a2b;      /* madder */
  --rule: #b9b3a6;        /* undyed grey */
  --mono: 'Space Mono', ui-monospace, Menlo, monospace;
  --serif: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body { font: 14px/1.6 var(--mono); overflow-x: hidden; -webkit-text-size-adjust: 100%; }
#app { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }

.top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.wordmark { font: 700 28px/1 var(--serif); letter-spacing: 0.02em; color: var(--ink); text-decoration: none; }
.wordmark b { color: var(--accent); }
.top .meta { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rule); }

label.field { display: block; margin: 0 0 12px; }
label.field span { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
input[type=text], textarea {
  width: 100%; font: inherit; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; padding: 8px 0; outline: none;
}
/* the textarea is ruled like the loom: one faint warp line per text line */
textarea {
  min-height: 12em; resize: vertical; line-height: 1.75em; padding: 0.35em 0 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.75em - 1px), var(--rule) calc(1.75em - 1px), var(--rule) 1.75em);
  background-attachment: local;
}
textarea::placeholder, input::placeholder { color: var(--rule); }

.length { font-size: 12px; margin: 8px 0 16px; min-height: 1.6em; }
.length.warn { color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.btn {
  font: 700 13px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  min-height: 44px; padding: 0 18px; border: 1.5px solid var(--ink); border-radius: 0;
  background: transparent; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center;
}
.btn:hover { background: var(--ink); color: var(--ground); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.btn--accent:hover { background: var(--ink); border-color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: default; }

/* the viewer */
.cloth { position: relative; width: 100%; overflow: hidden; background: var(--ground); }
.cloth--read { overflow: auto; max-height: 80vh; -webkit-overflow-scrolling: touch; cursor: crosshair; }
.cloth-layer { position: relative; transform-origin: 0 0; }
.cloth-layer canvas { position: absolute; left: 0; display: block; image-rendering: auto; }
.cloth-empty { height: 96px; border-top: 3px solid var(--accent); border-bottom: 3px solid var(--accent); margin: 12px 0; }
.word {
  position: fixed; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 8px));
  font: 700 12px/1 var(--mono); padding: 6px 8px; background: var(--ink); color: var(--ground); white-space: nowrap;
}
.title { font: 700 22px/1.2 var(--serif); margin: 0 0 4px; }
.fine { font-size: 11px; color: var(--rule); letter-spacing: 0.04em; }
