/* Page CSS (references/system.md: only inside a visual). The tool's own windows: the quick window in the
   hero, the editor in #buat, and the small editors in the #jenis cards. One white surface, one 1px line,
   one radius; the ink is the primary button, the accent marks the type being edited. */

/* ---------------------------------------------------------------- the window */
.qr-win {
  --fx-bg: #ffffff; --fx-surface: #f3f5f8; --fx-ink: var(--p-ink); --fx-muted: #555c68;
  --fx-accent: var(--p-accent); --fx-accent-ink: #ffffff;
  --ui-font: var(--font-text); --ui-radius: 16px;
  --qr-ctl: 44px;
  background: var(--u-bg); color: var(--u-ink); border: 1px solid var(--u-border); border-radius: var(--u-r);
  box-shadow: var(--u-shadow); overflow: hidden; font-size: 14px; line-height: 20px;
}
.qr-win__bar { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border-bottom: 1px solid var(--u-line); font-size: 13px; color: var(--u-muted); white-space: nowrap; }
.qr-win__dots { display: inline-flex; gap: 6px; margin-right: 6px; }
.qr-win__dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--u-fill-3); }
.qr-win__bar b { font-weight: 500; color: var(--u-ink); }
.qr-win__sp { flex: 1; }
.qr-win__bar [data-qr-info] { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- fields */
.qr-label { margin: 0 0 8px; font: 500 13px/16px var(--font-text); color: var(--u-muted); }
.qr-field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.qr-field > label { font: 500 13px/16px var(--font-text); color: var(--u-text-2); }
.qr-win :is(input:not([type="checkbox"], [type="color"]), select, textarea) {
  width: 100%; min-width: 0; height: var(--qr-ctl); padding: 0 12px; border: 1px solid var(--u-line-2); border-radius: 10px;
  background: var(--u-bg); color: var(--u-ink); font: 400 16px/1.25 var(--font-text); letter-spacing: 0;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.qr-win textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.qr-win select { appearance: none; padding-right: 32px; cursor: pointer;
  background: var(--u-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23555c68' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center / 12px no-repeat; }
.qr-win :is(input, select, textarea):focus-visible { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px color-mix(in oklab, var(--action) 22%, transparent); }
.qr-check { display: flex; align-items: center; gap: 10px; min-height: var(--qr-ctl); font: 400 14px/20px var(--font-text); color: var(--u-ink); cursor: pointer; align-self: end; }
.qr-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--p-ink); }
.qr-color { display: flex; align-items: center; gap: 10px; height: var(--qr-ctl); padding: 0 10px 0 4px; border: 1px solid var(--u-line-2); border-radius: 10px; }
.qr-color input { width: 36px; height: 36px; flex: none; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.qr-color input::-webkit-color-swatch-wrapper { padding: 0; }
.qr-color input::-webkit-color-swatch { border: 1px solid var(--u-line-2); border-radius: 8px; }
.qr-color input::-moz-color-swatch { border: 1px solid var(--u-line-2); border-radius: 8px; }
.qr-color span { font: 400 13px/1 var(--font-mono); color: var(--u-text-2); }
.qr-msg { margin: 0; min-height: 20px; font-size: 13px; line-height: 20px; color: var(--u-muted); }
.qr-msg.is-alert { color: #b42318; }
.qr-status { margin: 0; font-size: 13px; line-height: 20px; color: var(--u-text-2); }
.qr-status:empty { display: none; }

/* ---------------------------------------------------------------- buttons inside the tool */
.qr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--qr-ctl); padding: 0 16px;
  border: 1px solid var(--u-line-2); border-radius: 999px; background: var(--u-bg); color: var(--u-ink);
  font: 500 14px/1 var(--font-text); white-space: nowrap; cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.qr-btn svg { width: 16px; height: 16px; flex: none; }
.qr-btn:hover { background: var(--u-fill-2); }
/* the tool's main button is the page's primary (one primary look on every screen); the rest are the outline pill */
.qr-btn--ink { background: var(--p-action); border-color: transparent; color: var(--p-action-ink); }
.qr-btn--ink:hover { background: color-mix(in oklab, var(--p-action) 86%, var(--p-ink)); }
.qr-btn:active { transform: translateY(1px) scale(.985); }
.qr-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* the type list: a row per type, the one being edited marked (its icon takes the accent) */
.qr-tab, .qr-type {
  display: flex; align-items: center; gap: 10px; width: 100%; height: var(--qr-ctl); padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--u-text-2); font: 400 14px/1 var(--font-text); text-align: left; cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.qr-tab:hover, .qr-type:hover { background: var(--u-fill); color: var(--u-ink); }
.qr-tab[aria-selected="true"], .qr-type[aria-pressed="true"] { background: var(--u-fill-2); color: var(--u-ink); font-weight: 500; }
.qr-tab[aria-selected="true"] > svg, .qr-type[aria-pressed="true"] > svg { color: var(--u-accent); }
.qr-tab > :is(svg, img), .qr-type > :is(svg, img) { width: 18px; height: 18px; flex: none; }
.qr-tab:focus-visible, .qr-type:focus-visible { outline: 2px solid var(--action); outline-offset: -2px; }

/* the drawn code: a white tile; with nothing to show it dims and says why */
.qr-canvas { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; }
.qr-canvas > svg { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; aspect-ratio: 1; border-radius: 6px; box-shadow: 0 0 0 1px var(--u-line); }
.qr-canvas.is-empty > svg { opacity: .1; }
.qr-empty { display: none; position: absolute; inset: 0; place-items: center; margin: 0; padding: 12px; text-align: center; font-size: 13px; color: var(--u-muted); }
.qr-canvas.is-empty > .qr-empty { display: grid; }

/* ---------------------------------------------------------------- the hero's quick window */
.hero--centred .hero__window { container-type: size; }
.qr-win--quick { --qr-code: clamp(88px, calc(82cqh - 96px), 176px); }
.qr-quick { display: grid; grid-template-columns: 160px minmax(0, 1fr) var(--qr-code); gap: 20px; padding: 20px; align-items: start; }
.qr-quick__types { display: grid; gap: 4px; padding-right: 20px; border-right: 1px solid var(--u-line); }
.qr-quick__main { display: grid; gap: 8px; min-width: 0; }
.qr-quick__row { display: flex; gap: 8px; }
.qr-quick__row > input { flex: 1 1 auto; }
.qr-quick__acts { display: flex; gap: 8px; }
.qr-quick__code { width: var(--qr-code); height: var(--qr-code); }
@media (max-width: 1023px) {
  .qr-quick { grid-template-columns: minmax(0, 1fr) var(--qr-code); }
  .qr-quick__types { display: none; }
}
@media (max-width: 639px) {
  .qr-win__bar { height: 36px; }
  .qr-win__meta { display: none; }
  .qr-win--quick { --qr-code: clamp(88px, calc(100cqh - 186px), 132px); }
  .qr-quick { grid-template-columns: var(--qr-code) minmax(0, 1fr); gap: 12px; padding: 14px; }
  /* the label and the field across the window, then the code beside its two buttons */
  .qr-quick__main, .qr-quick__main > .qr-field, .qr-quick__row { display: contents; }
  .qr-quick__main label { grid-column: 1 / -1; grid-row: 1; margin-bottom: -6px; }
  .qr-quick__row > input { grid-column: 1 / -1; grid-row: 2; }
  .qr-quick__code { grid-column: 1; grid-row: 3; }
  .qr-quick__acts { grid-column: 2; grid-row: 3; display: grid; gap: 8px; align-content: start; }
  .qr-quick__acts .qr-btn { width: 100%; }
  .qr-quick .qr-msg { grid-column: 1 / -1; grid-row: 4; }
  .qr-quick .qr-msg:not(.is-alert), .qr-quick .qr-status { display: none; }
}

/* ---------------------------------------------------------------- the editor (#buat), app-frame */
.qr-head { align-items: start; }
.qr-head__text { display: grid; gap: var(--s-4); justify-items: start; }
.qr-head__text > p { font-size: var(--t-lead); line-height: 1.5; color: var(--ink); max-width: 52ch; }
.qr-app { display: flex; flex-direction: column; margin-top: var(--s-7); min-height: 0; }
.qr-app__body {
  flex: 1 1 auto; min-height: 0; display: grid;
  grid-template-columns: 200px minmax(0, 1fr) minmax(280px, 380px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "types fields preview" "types look preview";
}
.qr-app__types { grid-area: types; padding: 20px 12px; border-right: 1px solid var(--u-line); }
.qr-app__types .qr-label { padding-left: 12px; }
.qr-tabs { display: grid; gap: 4px; }
.qr-app__fields { grid-area: fields; padding: 24px 24px 0; }
.qr-app__look { grid-area: look; padding: 24px; }
.qr-app__look .qr-label { padding-top: 20px; border-top: 1px solid var(--u-line); }
.qr-app__preview { grid-area: preview; display: flex; flex-direction: column; gap: 12px; padding: 24px; min-height: 0; border-left: 1px solid var(--u-line); background: var(--u-fill); }
.qr-app__preview > .qr-canvas { flex: 1 1 0; min-height: 140px; }
.qr-app__preview > .qr-canvas > svg { width: auto; height: auto; max-height: 100%; }
.qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.qr-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qr-grid > .qr-span { grid-column: 1 / -1; }
.qr-hint { margin: 0; font-size: 13px; line-height: 18px; color: var(--u-muted); }
.qr-payload { margin: 0; display: grid; gap: 2px; }
.qr-payload .qr-label { margin: 0; }
.qr-payload code { font: 400 12px/16px var(--font-mono); color: var(--u-text-2); word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qr-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qr-acts .qr-btn { width: 100%; padding: 0 12px; }
.qr-swap { align-self: end; }
@media (min-width: 1024px) and (max-width: 1279px) {
  .qr-app { --qr-ctl: 40px; }
  .qr-app__body { grid-template-columns: 160px minmax(0, 1fr) minmax(240px, 300px); }
  .qr-app__types { padding: 16px 8px; }
  .qr-app__fields { padding: 20px 20px 0; }
  .qr-app__look { padding: 16px 20px 20px; }
  .qr-app__look .qr-label { padding-top: 16px; }
  .qr-app__preview { padding: 20px; gap: 10px; }
  .qr-app .qr-color span { display: none; }
  .qr-app .qr-grid { gap: 10px 12px; }
  .qr-app__fields .qr-hint { display: none; }
}
@media (max-width: 1023px) {
  .qr-head__text { margin-top: var(--s-4); }
  .qr-app__body {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "types types" "fields preview" "look preview";
  }
  .qr-app__types { padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--u-line); }
  .qr-app__types .qr-label { display: none; }
  .qr-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .qr-tab { justify-content: center; }
  .qr-app__fields { padding: 20px 20px 0; }
  .qr-app__look { padding: 20px; }
  .qr-app__preview { padding: 20px; }
}
@media (max-width: 639px) {
  #buat { --hm: 2; }
  /* the editor grows with its fields rather than squeeze its rows over each other on a short phone */
  .qr-app, .qr-app__body { flex: 1 0 auto; }
  .qr-app__body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas: "types" "fields" "preview" "look";
  }
  .qr-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-tab { justify-content: flex-start; }
  .qr-app__fields { padding: 16px 16px 0; }
  .qr-app__preview { padding: 16px; margin-top: 16px; border-left: 0; border-top: 1px solid var(--u-line); }
  .qr-app__preview > .qr-canvas { flex: none; width: min(100%, 300px); aspect-ratio: 1; margin-inline: auto; }
  .qr-app__look { padding: 16px; }
  .qr-app__look .qr-label { padding-top: 0; border-top: 0; }
  .qr-grid--3, .qr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-grid > .qr-field:has(textarea) { grid-column: 1 / -1; }
  .qr-win__bar [data-qr-info] { display: none; }
}
@media (max-width: 379px) {
  .qr-grid, .qr-grid--3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- the small editors in the #jenis cards */
#jenis .panel { --p-h: 336px; }
@media (min-width: 1024px) and (max-width: 1279px) { #jenis .panel { --p-h: 256px; } }
@media (max-width: 639px) { #jenis .panel { --p-h: 168px; } #jenis .stage { --fade-h: 40px; } }
.ui-mini {
  --fx-bg: #ffffff; --ui-font: var(--font-text);
  background: var(--u-bg); border: 1px solid var(--u-border); border-radius: 12px; box-shadow: var(--u-shadow); overflow: hidden;
}
.ui-mini__head { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-bottom: 1px solid var(--u-line); font-weight: 500; }
.ui-mini__head > :is(svg, img) { width: 18px; height: 18px; flex: none; color: var(--u-accent); }
.ui-mini__head small { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--u-muted); }
.ui-mini__body { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 14px; align-items: start; }
.ui-mini__code { width: 92px; height: 92px; }
.ui-mini__code > svg { display: block; width: 100%; height: 100%; border-radius: 4px; box-shadow: 0 0 0 1px var(--u-line); }
/* the Link card: the code first and large, the fields running out under the panel's right edge */
.ui-mini--wide .ui-mini__body { grid-template-columns: 168px minmax(0, 1fr); gap: 20px; }
.ui-mini--wide .ui-mini__code { width: 168px; height: 168px; }
/* the Teks card: the field, then the code large under it, as the editor stacks on a phone */
.ui-mini--stack .ui-mini__body { grid-template-columns: minmax(0, 1fr); }
.ui-mini--stack .ui-mini__code { order: 2; width: 200px; height: 200px; justify-self: center; margin-block: 8px; }
@media (max-width: 639px) {
  .ui-mini--wide .ui-mini__body { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .ui-mini--wide .ui-mini__code { width: 96px; height: 96px; }
  .ui-mini--stack .ui-mini__code { width: 140px; height: 140px; }
}
.ui-mini__fields { display: grid; gap: 10px; min-width: 0; }
.ui-mini__f { display: grid; gap: 4px; min-width: 0; }
.ui-mini__f > span:first-child { font-size: 12px; line-height: 16px; color: var(--u-muted); }
.ui-mini__v { display: block; min-height: 32px; padding: 5px 10px; border: 1px solid var(--u-line-2); border-radius: 8px; font-size: 13px; line-height: 20px; color: var(--u-ink); overflow-wrap: anywhere; }
.ui-mini__v--area { height: auto; min-height: 52px; padding: 6px 10px; line-height: 20px; white-space: normal; }
.ui-mini__v--mono { font-family: var(--font-mono); font-size: 12px; }
.ui-mini__acts { display: flex; gap: 8px; padding: 0 14px 14px; position: relative; }
.ui-mini__btn { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--u-line-2); font-size: 12px; font-weight: 500; }
.ui-mini__btn--ink { background: var(--p-action); border-color: var(--p-action); color: var(--p-action-ink); }
.ui-mini__done { display: inline-flex; align-items: center; gap: 6px; height: 30px; margin-left: 4px; font-size: 12px; color: var(--u-text-2); white-space: nowrap; }
.ui-mini__done svg { width: 14px; height: 14px; color: var(--u-accent); }
.ui-mini__cursor { position: absolute; left: 0; top: 0; width: 18px; height: 18px; pointer-events: none; }

/* the Link card's loop (motion.md, Loops inside a card's visual): the pointer glides to Unduh PNG, presses it, and the
   saved file's name comes up; 3.2 s a cycle, the finished picture held from 60%. Only that card holds data-m-loop */
[data-m-loop] { --m-still: 0.9; }
/* the loop runs only on the scripted page (html.mo-js): without scripts the finished picture stands, the pointer hidden */
.ui-mini__cursor { opacity: 0; }
.mo-js [data-m-loop] .ui-mini__cursor { transform: translate(var(--cx1), var(--cy1)); animation: qr-cursor var(--m-cycle) var(--ease) infinite; }
.mo-js [data-m-loop] .ui-mini__btn--ink { animation: qr-press var(--m-cycle) linear infinite; }
.mo-js [data-m-loop] .ui-mini__done { animation: qr-done var(--m-cycle) linear infinite; }
.ui-mini__acts { --cx0: 220px; --cy0: -46px; --cx1: 52px; --cy1: 16px; }
@keyframes qr-cursor {
  0%, 8% { transform: translate(var(--cx0), var(--cy0)); opacity: 0; }
  14% { opacity: 1; }
  40%, 100% { transform: translate(var(--cx1), var(--cy1)); opacity: 1; }
}
@keyframes qr-press { 0%, 44% { transform: none; } 47% { transform: scale(.96); } 52%, 100% { transform: none; } }
@keyframes qr-done { 0%, 52% { opacity: 0; transform: translateY(4px); } 60%, 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  [data-m-loop] .ui-mini__cursor { display: none; }
  [data-m-loop] :is(.ui-mini__btn--ink, .ui-mini__done) { animation: none; opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- the format split: three plain facts */
.qr-facts { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.qr-facts li { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); font-size: var(--t-body); line-height: 1.5; color: var(--ink); }
.qr-facts li:first-child { border-top: 1px solid var(--line); }
.qr-facts b { font-weight: 500; min-width: 7.5em; }
/* the files frame: 5:4 beside the words; lower when the split stacks, so words and frame stay one screen */
#format .frame { --ratio: 80%; }
@media (min-width: 640px) and (max-width: 1023px) { #format .frame { --ratio: 56%; } }
@media (max-width: 639px) { #format .frame { --ratio: 72%; } }

/* close-word: the name from line to line (about 4.9 em wide in Gabarito at this tracking); the line box tall enough
   for the descenders of g and y */
.close__word { font-size: calc(min(100vw - 2 * var(--gut), 1280px) / 4.95); line-height: 1.1; }

/* the centred hero's grey line is read text: ink, 7:1 (system.md, Type) */
.hero--centred .hero__lead { color: var(--ink); }

/* the questions: the head beside the page's own code on the lit ground, the four answers under them in two columns;
   on a phone the head and the code fill the first screen, the answers the second */
/* the head row takes what the four answers leave, so the code's frame reaches the section's foot at every height */
#faq .faq-head { flex: 1 1 auto; min-height: 0; }
#faq .faq-code { --ratio: 0px; align-self: stretch; min-height: 200px; padding: var(--s-5); }
.faq-code__tile { padding: 12px; border-radius: var(--r-md); background: #ffffff; box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 12px 32px -12px rgb(0 0 0 / .25); }
.faq-code__tile > svg { display: block; width: clamp(120px, 13vw, 184px); height: auto; aspect-ratio: 1; }
#faq .faq > .faq__item { align-content: start; }
#faq .faq--grid { margin-top: var(--head-gap); }
@media (min-width: 640px) {
  #faq .faq--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gutter); }
  #faq .faq--grid > .faq__item:nth-child(2) { padding-top: 0; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  #faq .faq-head > * { grid-column: auto / span 6; }
}
@media (max-width: 639px) {
  #faq .faq-head { display: flex; flex-direction: column; gap: var(--s-6); height: 100%; }
  #faq .faq-code { flex: 1 1 0; }
  #faq .faq--grid { margin-top: 0; }
  /* the answers fill their phone screen (the second of the section), so the gap to the footer matches the others */
  #faq .faq > .faq__item { padding-block: var(--s-6); }
  #faq .faq > .faq__item:first-child { padding-top: 0; }
  /* a short phone grows the sections rather than squeeze the frame under the words */
  #format .grid.fill { flex: 1 0 auto; }
  #format .grid.fill > .frame--fill { min-height: 140px; }
}
