/* the site's fonts (Google's Kanit, Fontsource's Anuphan), Thai and Latin halves */
@font-face { font-family: daisi-kanit; src: url(fonts/kanit-700i-thai.woff2) format("woff2"); font-weight: 700; font-style: italic; unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: daisi-kanit; src: url(fonts/kanit-700i-latin.woff2) format("woff2"); font-weight: 700; font-style: italic; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: daisi-anuphan; src: url(fonts/anuphan-400-thai.woff2) format("woff2"); font-weight: 400; unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: daisi-anuphan; src: url(fonts/anuphan-400-latin.woff2) format("woff2"); font-weight: 400; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: daisi-anuphan; src: url(fonts/anuphan-600-thai.woff2) format("woff2"); font-weight: 600; unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: daisi-anuphan; src: url(fonts/anuphan-600-latin.woff2) format("woff2"); font-weight: 600; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand: #034a28;
  --paper: #f6f8f2;
  --dark: #04542a;
  --green: #059444;
  --line: #dce3d6;
  --lime: #d7f23c;
  --muted: #4f6b5b;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 17px/28px daisi-anuphan, sans-serif; color: var(--dark); background: var(--paper); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

main { display: grid; gap: 24px; max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter) 32px; }

/* the preview stays in sight while the keyboard is up */
.preview { position: sticky; top: 0; z-index: 1; padding-top: var(--gutter); background: var(--paper); }
canvas { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--brand); }

form { display: grid; gap: 20px; align-content: start; }
label { display: grid; gap: 6px; }
label span, legend { font-weight: 600; font-size: 15px; line-height: 20px; }

/* size: two segments, the chosen one filled */
.sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0; padding: 0; border: 0; min-width: 0; }
.sizes legend { padding: 0; margin-bottom: 6px; }
.sizes label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  height: 56px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 13px; line-height: 18px; color: var(--muted); cursor: pointer; font-variant-numeric: tabular-nums;
}
.sizes b { font-weight: 600; font-size: 16px; line-height: 22px; color: var(--dark); }
.sizes input { position: absolute; opacity: 0; pointer-events: none; }
.sizes label:hover { border-color: #b9c6b0; }
.sizes label:has(:checked) { border-color: var(--brand); background: var(--brand); color: rgb(255 255 255 / 0.75); }
.sizes label:has(:checked) b { color: #fff; }
.sizes label:has(:focus-visible) { outline: 3px solid var(--lime); outline-offset: 2px; }
textarea {
  width: 100%;
  min-height: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: inherit;
  background: #fff;
  resize: vertical;
  field-sizing: content;
}
textarea[name="title"] { min-height: calc(2 * 28px + 22px); }
textarea[name="subtitle"] { min-height: calc(3 * 28px + 22px); }
textarea:hover { border-color: #b9c6b0; }
textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgb(5 148 68 / 0.18); }

button {
  height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  font: 600 17px/1 daisi-anuphan, sans-serif;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}
button:hover { background: #02391f; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

@media (min-width: 900px) {
  :root { --gutter: 40px; }
  main { grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; padding-bottom: var(--gutter); }
  .preview { top: 0; padding-bottom: var(--gutter); }
  form { padding-top: var(--gutter); }
}
