/*
 * THTC Font Maker.
 * Reads The Handdrawn Type Club theme tokens (--ink, --line, --mono, --hand, …) when they
 * exist, so the tool matches that theme exactly; other themes get the same black-and-white
 * look with their own text font.
 */

.fm {
	--fm-ink: var(--ink, #111111);
	--fm-paper: var(--paper, #ffffff);
	--fm-line: var(--line, #e3e3e3);
	--fm-muted: var(--muted, #555555);
	--fm-body: var(--body, #333333);
	--fm-soft: var(--soft, #f5f5f5);
	--fm-danger: var(--danger, #b42318);
	--fm-sans: var(--sans, inherit);
	--fm-mono: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	--fm-hand: var(--hand, "Comic Sans MS", "Segoe Print", cursive);
	--fm-radius: var(--radius, 6px);

	display: flex; flex-direction: column;
	font-family: var(--fm-sans); font-size: 16px; line-height: 1.5; color: var(--fm-ink);
	text-align: left;
}
.fm *, .fm *::before, .fm *::after { box-sizing: border-box; }
.fm button, .fm input, .fm select { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.fm p, .fm h2, .fm h3, .fm ul, .fm ol, .fm figure, .fm fieldset { margin: 0; }
.fm a { color: var(--fm-ink); }
.fm :focus-visible { outline: 1px solid var(--fm-ink); outline-offset: 3px; }
.fm [hidden] { display: none !important; }

.fm-mono { font-family: var(--fm-mono); }
.fm-muted { color: var(--fm-muted); }
.fm-strong { font-weight: 500; }
.fm-sr {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.fm-icon { flex: 0 0 auto; }
.fm-label, .fm-kicker {
	font-family: var(--fm-mono); font-size: 12px; font-weight: 400; text-transform: uppercase;
	letter-spacing: 0.1em; color: var(--fm-muted);
}
.fm-kicker { font-size: 11px; }
.fm-small { font-size: 12px; line-height: 1.55; color: var(--fm-muted); }
.fm-note { font-size: 14px; line-height: 1.6; color: var(--fm-muted); max-width: 640px; }
.fm-alert { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--fm-danger); border-radius: var(--fm-radius); color: var(--fm-danger); font-size: 14px; }
.fm-empty { padding: 24px 0; border-top: 1px solid var(--fm-ink); color: var(--fm-muted); font-size: 15px; }

/* Buttons */
.fm-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 36px; padding: 0 16px; border: 1px solid var(--fm-ink); border-radius: var(--fm-radius);
	background: var(--fm-paper); color: var(--fm-ink); font-size: 14px; line-height: 1.2; font-weight: 400;
	cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: none;
	transition: background-color .2s ease, color .2s ease;
}
.fm-btn:hover { background: var(--fm-ink); color: var(--fm-paper); text-decoration: none; }
.fm-btn.is-dark { background: var(--fm-ink); color: var(--fm-paper); }
.fm-btn.is-dark:hover { background: #333333; border-color: #333333; color: var(--fm-paper); }
.fm-btn.is-lg { min-height: 42px; padding: 0 22px; }
.fm-btn.is-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.fm-btn:disabled, .fm-btn:disabled:hover { border-color: var(--fm-line); background: var(--fm-soft); color: var(--fm-muted); cursor: default; }

/* Thin range sliders */
.fm input[type=range] { -webkit-appearance: none; appearance: none; height: 16px; background: transparent; cursor: pointer; margin: 0; padding: 0; border: 0; }
.fm input[type=range]::-webkit-slider-runnable-track { height: 1px; background: var(--fm-ink); }
.fm input[type=range]::-moz-range-track { height: 1px; background: var(--fm-ink); }
.fm input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--fm-ink); border: none; margin-top: -4.5px; }
.fm input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--fm-ink); border: none; }

/* How it works */
.fm-steps {
	list-style: none; margin: 0 0 24px; padding: 0;
	display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	border-top: 1px solid var(--fm-ink); border-left: 1px solid var(--fm-line);
}
.fm-steps li {
	display: flex; flex-direction: column; gap: 10px; padding: 24px; margin: 0;
	border-right: 1px solid var(--fm-line); border-bottom: 1px solid var(--fm-line);
	font-size: 14px; line-height: 1.55; color: var(--fm-body);
}
.fm-steps .fm-mono { font-size: 12px; color: var(--fm-muted); }
.fm-steps strong { font-size: 16px; font-weight: 500; color: var(--fm-ink); }

/* Sections */
.fm-section { padding: 72px 0; border-bottom: 1px solid var(--fm-line); }
.fm-section.is-last { border-bottom: none; padding-bottom: 0; }
.fm-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; max-width: 720px; }
.fm-h2 { margin: 0; padding: 0; border: 0; font-family: var(--fm-sans); font-size: 28px; font-weight: 500; line-height: 1.2; color: var(--fm-ink); letter-spacing: normal; text-transform: none; }
.fm-head .fm-muted { font-size: 15px; line-height: 1.6; }

/* Step 1 */
.fm-split { display: flex; flex-wrap: wrap; gap: 40px 64px; align-items: flex-start; }
.fm-col { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.fm-sheets { border: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.fm-sheets legend { padding: 0; margin-bottom: 12px; float: left; width: 100%; }
.fm-sheets legend + * { clear: both; }
.fm-option {
	display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0; cursor: pointer;
	border: 1px solid var(--fm-line); border-radius: var(--fm-radius); transition: border-color .2s ease;
}
.fm-option:has(input:checked) { border-color: var(--fm-ink); }
.fm-option input { accent-color: var(--fm-ink); width: 16px; height: 16px; margin: 0; flex: 0 0 auto; }
.fm-option-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.fm-option-name { font-size: 14px; font-weight: 500; }
.fm-option-note { font-size: 12px; color: var(--fm-muted); }
.fm-option-meta { font-size: 12px; color: var(--fm-muted); }
.fm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.fm-tips { padding: 0; list-style: none; border-top: 1px solid var(--fm-ink); }
.fm-tips li { margin: 0; padding: 12px 0 12px 28px; border-bottom: 1px solid var(--fm-line); font-size: 14px; line-height: 1.55; color: var(--fm-body); position: relative; }
.fm-tips li::before { content: "✓"; position: absolute; left: 4px; top: 12px; color: var(--fm-ink); }
.fm-sheet-preview { flex: 1 1 280px; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.fm-sheet-preview canvas { width: 100%; height: auto; display: block; border: 1px solid var(--fm-ink); background: #ffffff; }
.fm-sheet-preview figcaption { font-size: 12px; margin: 0; }

/* Step 2 */
.fm-drop {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center;
	min-height: 220px; padding: 40px 24px; margin: 0; border: 1px dashed var(--fm-ink); border-radius: var(--fm-radius);
	cursor: pointer; transition: background-color .2s ease; position: relative;
}
.fm-drop:hover, .fm-drop.is-over { background: var(--fm-soft); }
.fm-drop:focus-within { outline: 1px solid var(--fm-ink); outline-offset: 3px; }
.fm-drop-title { font-size: 22px; font-weight: 500; }
.fm-drop .fm-mono { font-size: 12px; }
.fm-drop .fm-btn { margin-top: 8px; }
.fm-drop:hover .fm-btn { background: var(--fm-ink); color: var(--fm-paper); }
.fm-pages { margin-top: 32px; border-top: 1px solid var(--fm-ink); }
.fm-page { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 20px 0; border-bottom: 1px solid var(--fm-line); }
.fm-thumb { flex: 0 0 64px; height: 88px; border: 1px solid var(--fm-line); background: var(--fm-soft); overflow: hidden; }
.fm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; max-width: none; }
.fm-page-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fm-page-text .fm-strong { font-size: 15px; overflow-wrap: anywhere; }
.fm-page-text .fm-mono { font-size: 12px; line-height: 1.5; }
.fm-page.is-problem .fm-page-text .fm-mono { color: var(--fm-danger); }
.fm-page-actions { display: flex; gap: 8px; }
.fm-select { margin-top: 8px; max-width: 320px; font-size: 13px; color: var(--fm-ink); background: var(--fm-paper); border: 1px solid var(--fm-ink); border-radius: var(--fm-radius); padding: 6px 10px; min-height: 34px; }

/* Bars (step 3 and 4) */
.fm-bar {
	border-top: 1px solid var(--fm-ink); border-bottom: 1px solid var(--fm-ink);
	padding: 16px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px;
}
.fm-bar.is-slim { padding: 12px 0; gap: 12px 24px; margin-bottom: 32px; }
.fm-bar label { margin: 0; }
.fm-range {
	display: flex; align-items: center; gap: 8px; font-family: var(--fm-mono); font-size: 11px;
	text-transform: uppercase; letter-spacing: 0.06em; color: var(--fm-muted); font-weight: 400;
}
.fm-range input { width: 120px; }
.fm-range output { width: 36px; color: var(--fm-ink); text-transform: none; }
.fm-count { margin-left: auto; font-size: 12px; color: var(--fm-muted); }
.fm-tester-text { flex: 999 1 320px; display: flex; align-items: center; gap: 12px; min-width: 0; }
.fm-tester-text input {
	flex: 1; min-width: 0; border: none; outline: none; font-size: 18px; background: transparent;
	padding: 10px 0; margin: 0; box-shadow: none; border-radius: 0; height: auto;
}
.fm-tester-size { flex: 1 1 240px; display: flex; align-items: center; gap: 12px; }
.fm-tester-size input { flex: 1; }
.fm-tester-size output { font-size: 13px; width: 48px; text-align: right; }

/* Step 3 */
.fm-review { display: flex; flex-direction: column; gap: 40px; }
.fm-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.fm-group-head h3 { margin: 0; font-family: var(--fm-sans); font-size: 15px; font-weight: 500; letter-spacing: normal; text-transform: none; }
.fm-group-head .fm-mono { font-size: 12px; }
.fm-glyphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); border-top: 1px solid var(--fm-line); border-left: 1px solid var(--fm-line); }
.fm-glyph {
	position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 10px; margin: 0;
	border: 0; border-right: 1px solid var(--fm-line); border-bottom: 1px solid var(--fm-line); border-radius: 0;
	background: var(--fm-paper); color: var(--fm-ink); cursor: pointer; box-shadow: none; min-height: 0;
	transition: background-color .15s ease, color .15s ease;
}
button.fm-glyph:hover, button.fm-glyph:focus { background: var(--fm-ink); color: var(--fm-paper); }
.fm-glyph svg { width: 100%; height: 100%; display: block; overflow: visible; }
.fm-glyph svg path { fill: currentColor; }
.fm-base { stroke: var(--fm-line); stroke-width: 6; }
button.fm-glyph:hover .fm-base { stroke: #444444; }
.fm-char { position: absolute; left: 6px; top: 4px; font-family: var(--fm-mono); font-size: 11px; line-height: 1.2; color: var(--fm-muted); }
button.fm-glyph:hover .fm-char { color: #bbbbbb; }
.fm-glyph.is-off svg { opacity: .18; }
.fm-glyph.is-off::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 1px; background: var(--fm-muted); transform: rotate(-35deg); }
.fm-glyph.is-missing { cursor: default; background: var(--fm-soft); }
.fm-glyph.is-missing .fm-char { color: #8a8a8a; }

/* Step 4 */
.fm-preview {
	padding: 32px 0 40px; border-bottom: 1px solid var(--fm-line); color: var(--fm-ink);
	font-size: 96px; line-height: 1.15; overflow-wrap: anywhere; white-space: pre-wrap; min-height: 1.6em;
}
.fm-preview.is-empty { color: #c9c9c9; font-family: var(--fm-hand); }
.fm-save { padding-top: 40px; display: flex; flex-direction: column; gap: 28px; max-width: 720px; }
.fm-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.fm-field { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 13px; color: var(--fm-muted); font-weight: 400; }
.fm-field input {
	border: none; border-bottom: 1px solid var(--fm-ink); border-radius: 0; font-size: 16px; padding: 10px 0; margin: 0;
	outline: none; background: transparent; color: var(--fm-ink); width: 100%; box-shadow: none; height: auto;
}
.fm-field input:focus { border-bottom-width: 2px; padding-bottom: 9px; }

/* Block themes: use the wide width instead of the narrow text column. */
.is-layout-constrained > .fm { max-width: min(var(--wp--style--global--wide-size, 1120px), 1120px); }

/* Full-width page from the plugin template (themes other than THTC). */
.fm-wrap { max-width: var(--max, 1120px); margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 120px; }
.fm-intro { padding: 72px 0 40px; }
.fm-title { margin: 0; font-weight: 500; font-size: clamp(40px, 5vw, 64px); line-height: 1.05; letter-spacing: -0.02em; }
.fm-lead { margin: 24px 0 0; font-size: 18px; line-height: 1.6; max-width: 640px; }
.fm-main .fm-content > .fm:first-child { margin-top: 0; }
/* THTC theme: the handwritten word's tail overhangs, give the next word room. */
.thtc-fm-page .thtc-title .thtc-hand { margin-right: .12em; }

@media (max-width: 720px) {
	.fm-section { padding: 48px 0; }
	.fm-sheet-preview { max-width: none; }
	.fm-glyphs { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
	.fm-count { margin-left: 0; }
	.fm-range input { width: 100px; }
	.fm-intro { padding: 48px 0 32px; }
}

/* Print quality */
.fm-quality-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px; }
.fm-option input[type=radio] { border-radius: 50%; }
