/* Qraft — a printed QR tag. The code sits on a white card on the shared dot-grid desk. */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}
body {
  margin: 0;
  --ui-accent: #286354;
  --ui-accent-hover: #1d4d40;
  --q-text: #273247;
  --q-muted: #606c80;
  --q-line: #dce1e8;
  --q-line-soft: #e9ecf1;
  --q-desk: #f3f4f7;
  --q-dot: #d3d9e2;
  --q-green-tint: #eaf2ef;
  --q-danger: #a23d30;
  --q-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  font-size: 14px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
summary,
input[type="color"] {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  min-height: 42px;
  border: 1px solid var(--q-line);
  border-radius: 3px;
  padding: 9px 16px;
  color: var(--q-text);
  background: white;
  font-weight: 600;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
button:hover:not(:disabled) {
  background: #f0f4f2;
}
a {
  color: var(--ui-accent);
  text-underline-offset: 4px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
main {
  max-width: 1088px;
  padding: 0 32px;
  margin: auto;
}
.eyebrow {
  color: var(--ui-accent);
  font-size: 12px;
  letter-spacing: 0.16em;
  font-weight: 750;
  margin: 0 0 10px;
}
h2 {
  font-size: 18px;
  margin: 0;
  line-height: 1.5;
}
h3 {
  font-size: 16px;
}

/* Work area: the URL on the left, the tag on the desk on the right. */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  background: white;
  border: 1px solid var(--q-line);
  border-radius: 3px;
}
.input-panel,
.result-panel {
  min-width: 0;
  padding: var(--space-panel, 24px);
}
.input-panel {
  border-right: 1px solid var(--q-line);
}
.muted {
  color: var(--q-muted);
  font-size: 13px;
  margin: 6px 0 16px;
}
textarea {
  display: block;
  resize: vertical;
  width: 100%;
  min-height: 116px;
  max-height: 300px;
  padding: 14px 16px;
  border: 1px solid #acbab5;
  border-radius: 3px;
  font-size: 16px;
  line-height: 1.6;
  background: #fff;
  color: var(--q-text);
  overflow-wrap: anywhere;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
textarea:hover {
  border-color: #8fa39c;
}
textarea:focus {
  border-color: var(--ui-accent);
}
textarea::placeholder {
  color: #8a9592;
}
textarea[aria-invalid="true"] {
  border-color: var(--q-danger);
}
.input-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--q-muted);
  font-size: 12px;
}
.input-tools .text-button {
  flex: none;
  white-space: nowrap;
}
.text-button {
  padding: 4px 0;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--ui-accent);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-button:hover:not(:disabled) {
  background: transparent;
  color: var(--ui-accent-hover);
}
/* Why there is no code is said where the code would be, so the input column never grows. */
.error {
  max-width: 17em;
  margin: 0;
  color: var(--q-danger);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}
.qr-draft:has(.error:not([hidden])) .draft-note {
  display: none;
}
.qr-draft:has(.error:not([hidden])) svg {
  opacity: 0.45;
}
/* The settings disclosure only: the explanation's FAQ keeps the shared marks. */
#settings {
  margin-top: 24px;
  border-top: 1px solid var(--q-line-soft);
  border-bottom: 1px solid var(--q-line-soft);
}
#settings > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 14px 0;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}
#settings > summary::-webkit-details-marker {
  display: none;
}
#settings > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.6px solid var(--q-muted);
  border-bottom: 1.6px solid var(--q-muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s var(--q-ease);
}
#settings[open] > summary::after {
  transform: translateY(2px) rotate(225deg);
}
#settings > summary > .muted {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
}
/* One row per setting, so the open panel fits the space the collapsed one leaves. */
.settings-body {
  display: grid;
  gap: 12px;
  padding: 2px 0 14px;
}
.setting-row {
  display: grid;
  grid-template-columns: 6.5em minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.setting-row select {
  max-width: 240px;
}
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--q-line);
  background: #fff;
  color: var(--q-text);
  border-radius: 3px;
  padding: 6px;
}
.color-control {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
}
input[type="color"] {
  width: 40px;
  height: 40px;
  border: 1px solid var(--q-line);
  padding: 3px;
  background: #fff;
  border-radius: 3px;
}
.color-control output {
  font-size: 12px;
}
.color-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.color-field legend {
  float: left;
  padding: 0;
  font-size: 12px;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 3px transparent;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.swatch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  opacity: 0;
  cursor: pointer;
}
.swatch:hover {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 3px #acbab5;
}
.swatch:has(input:checked),
.swatch.is-selected {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--q-text);
}
.swatch:has(input:focus-visible) {
  outline: 3px solid var(--ui-accent);
  outline-offset: 5px;
}
.swatch-custom:not(.is-selected) {
  background: conic-gradient(#b13a3a, #b58a1c, #2f7a4b, #245f9e, #6a3a9a, #b13a3a);
}
.swatch-custom::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
}
.swatch-custom.is-selected::after {
  display: none;
}
.swatches output {
  color: var(--q-muted);
  font-size: 12px;
}
.settings-body .text-button {
  justify-self: start;
  margin-left: calc(6.5em + 12px);
}

/* Result: the tag on the desk. */
.result-panel {
  display: flex;
  flex-direction: column;
}
.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
  margin-bottom: 16px;
}
#export-actions {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  gap: 6px;
  margin-left: auto;
}
#export-actions button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.preview-stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 28px 16px;
  border: 1px solid var(--q-line-soft);
  border-radius: 3px;
  background-color: var(--q-desk);
  background-image: radial-gradient(var(--q-dot) 1px, transparent 1.2px);
  background-size: 20px 20px;
  background-position: 10px 10px;
}
.qr-card {
  width: min(100%, 290px);
  margin: 0;
  padding: 16px 16px 14px;
  border: 1px solid var(--q-line);
  border-radius: 3px;
  background: #fff;
}
.qr-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
}
.qr-frame canvas {
  display: block;
  width: 256px;
  height: auto;
  max-width: 100%;
}
/* When a code first appears, a scan line sweeps down as the modules print. */
/* Both ends are explicit so the clip interpolates instead of switching halfway. */
@keyframes q-print {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes q-scan {
  from {
    top: 0;
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  to {
    top: 100%;
    opacity: 0;
  }
}
.qr-frame.is-revealing canvas {
  animation: q-print 0.7s var(--q-ease) both;
}
.qr-frame.is-revealing::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  height: 2px;
  background: var(--ui-accent);
  box-shadow: 0 0 14px 3px #2863544d;
  animation: q-scan 0.7s var(--q-ease) both;
  pointer-events: none;
}
.qr-draft {
  animation: q-fade 0.3s ease-out;
}
@keyframes q-fade {
  from {
    opacity: 0;
  }
}
.qr-draft {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
  text-align: center;
}
.qr-draft svg {
  width: 68%;
  max-width: 172px;
  overflow: visible;
}
.draft-finder {
  fill: none;
  stroke: #b8c7c0;
  stroke-width: 1;
  stroke-dasharray: 1.2 0.8;
}
.draft-eye,
.draft-modules {
  fill: #d4dfda;
}
.qr-draft p span {
  display: inline-block;
}
.qr-draft p {
  margin: 0;
  color: #53695f;
  font-size: 13px;
  line-height: 1.6;
}
/* One reserved line under the desk: the paste hint, or a failure or warning in its place. */
.result-note {
  display: grid;
  align-items: center;
  min-height: 48px;
  margin-top: 8px;
}
.result-note > * {
  grid-area: 1 / 1;
}
.paste-hint {
  margin: 0;
  color: var(--q-muted);
  font-size: 12px;
  text-align: center;
}
.paste-hint[data-idle="true"],
.result-note:has(.status[data-tone="error"], .status[data-tone="warning"]) .paste-hint {
  visibility: hidden;
}
.status {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}
.status:empty,
.status[data-tone="success"],
.status[data-tone="quiet"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.status[data-tone="error"],
.status[data-tone="warning"] {
  padding-left: 10px;
  border-left: 3px solid;
}
.status[data-tone="error"] {
  color: var(--q-danger);
}
.status[data-tone="warning"] {
  color: #6f4d0c;
}
#export-actions button.is-done {
  opacity: 1;
}
#export-actions button.primary.is-done {
  background: var(--ui-accent-hover);
  border-color: var(--ui-accent-hover);
}
#export-actions button:not(.primary).is-done {
  border-color: var(--ui-accent);
  color: var(--ui-accent);
}
footer {
  max-width: 1088px;
  margin: 48px auto 0;
  padding: 24px 32px;
  border-top: 1px solid var(--q-line);
  font-weight: 650;
}
footer span {
  font-size: 12px;
  color: var(--q-muted);
  margin-left: 14px;
  font-weight: 400;
}
dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px;
  border: 1px solid var(--q-line);
  border-radius: 3px;
  color: var(--q-text);
  background: #fff;
}
dialog::backdrop {
  background: #27324766;
}
dialog p,
dialog li {
  font-size: 14px;
  color: var(--q-muted);
}
dialog ol {
  padding-left: 24px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.dialog-actions button {
  font-size: 12px;
}
#spotlight {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 0 0 9999px #27324766;
  border-radius: 3px;
}
#tour {
  position: fixed;
  z-index: 31;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--q-line);
  border-radius: 3px;
}
#tour h2 {
  font-size: 18px;
}
#tour-description {
  font-size: 13px;
}
#tour .dialog-actions {
  margin-top: 16px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* PC: the work area keeps one height whatever the user opens, types or triggers. */
@media (min-width: 901px) {
  .workspace {
    height: 520px;
  }
  .preview-stage {
    min-height: 0;
  }
  .input-panel {
    overflow: auto;
  }
  textarea {
    resize: none;
  }
}
/* Tablets and phones: one column that grows in place. */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--q-line);
  }
  .preview-stage {
    min-height: 0;
  }
}
@media (max-width: 760px) {
  main {
    padding: 0 18px;
  }
  .input-panel,
  .result-panel {
    padding: 16px;
  }
  header nav {
    gap: 5px;
  }
  footer {
    padding-inline: 18px;
  }
  textarea {
    height: 76px;
    min-height: 76px;
  }
  #settings {
    margin-top: 12px;
  }
  /* The two buttons stay side by side; where they do not fit beside the title, they take the
     next line together instead of splitting the title and each other. */
  .result-heading {
    margin-bottom: 12px;
  }
  #export-actions {
    flex-wrap: nowrap;
  }
  .preview-stage {
    min-height: 0;
    padding: 12px;
  }
  .qr-card {
    width: min(100%, 264px);
    padding: 12px 12px 10px;
  }
  .qr-frame canvas {
    width: 240px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
