/* Two-tone QR page. Uses the site's tokens from css/main.css; everything is
   scoped under .qr2- so it cannot leak into the rest of the site. */

.qr2-hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3rem 1.5rem 1rem;
}

.qr2-title {
  margin: 0.25rem 0 0.75rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.qr2-lede {
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.7;
  margin: 0;
}

.qr2-shell {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

@media (max-width: 900px) {
  .qr2-shell {
    grid-template-columns: minmax(0, 1fr);
  }
}

.qr2-panel,
.qr2-preview {
  display: grid;
  gap: 1.25rem;
  align-content: start;
  padding: 1.25rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.qr2-field {
  display: grid;
  gap: 0.4rem;
}

.qr2-field > span,
.qr2-group legend {
  font-family: var(--font-header);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.qr2-field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.qr2-field input:focus-visible {
  border-color: var(--cta);
}

.qr2-field small,
.qr2-group > small {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.qr2-field output {
  color: var(--text-secondary);
  font-family: var(--font-body);
  overflow-wrap: anywhere;
}

.qr2-field code {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.qr2-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.qr2-group legend {
  padding: 0;
  margin-bottom: 0.6rem;
}

.qr2-examples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.qr2-palettes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.qr2-example,
.qr2-palette {
  position: relative;
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.qr2-example input,
.qr2-palette input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.qr2-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: #0c0c0e;
}

.qr2-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qr2-example input:checked + .qr2-thumb,
.qr2-palette input:checked + .qr2-swatch {
  outline: 3px solid var(--cta);
  outline-offset: 2px;
}

.qr2-example input:focus-visible + .qr2-thumb,
.qr2-palette input:focus-visible + .qr2-swatch {
  outline: 3px solid var(--text-primary);
  outline-offset: 2px;
}

.qr2-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: center;
}

.qr2-example input:checked ~ .qr2-name,
.qr2-palette input:checked ~ .qr2-name {
  color: var(--text-primary);
}

.qr2-swatch {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.35rem;
}

.qr2-generate {
  width: 100%;
  font-size: 1rem;
}

.qr2-preview {
  justify-items: stretch;
}

.qr2-stage {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-height: 70vh;
  padding: 0.75rem;
  background: #ffffff;
  border-radius: 12px;
}

.qr2-stage canvas {
  max-width: 100%;
  max-height: 68vh;
  width: auto;
  height: auto;
  image-rendering: pixelated;
}

.qr2-status {
  margin: 0;
  min-height: 1.5em;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.qr2-error {
  margin: 0;
  padding: 0.65rem 0.8rem;
  color: #ffd9d2;
  background: rgba(225, 29, 72, 0.16);
  border: 1px solid rgba(225, 29, 72, 0.5);
  border-radius: 8px;
  font-size: 0.875rem;
}

.qr2-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.qr2-actions button {
  padding: 0.6rem 1rem;
  font-family: var(--font-header);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--cta);
  border: 1px solid var(--cta);
  border-radius: 10px;
  cursor: pointer;
}

.qr2-actions button.qr2-alt {
  color: var(--text-primary);
  background: transparent;
  border-color: var(--glass-border);
}

.qr2-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.qr2-help {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
}

.qr2-help summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
}

.qr2-help p {
  margin: 0.6rem 0 0;
}

.qr2-help a {
  color: var(--cta-light);
  text-decoration: underline;
}

@media (max-width: 420px) {
  .qr2-examples {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.qr2-local {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.qr2-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.qr2-file:hover {
  border-color: var(--cta);
}

.qr2-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.qr2-file:focus-within {
  outline: 3px solid var(--text-primary);
  outline-offset: 2px;
}

.qr2-local-note {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.qr2-local-note[hidden] {
  display: none;
}

.qr2-local-note canvas {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  flex: none;
}

.qr2-local-note button {
  margin-left: auto;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.75rem;
  cursor: pointer;
}

.qr2-save {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.qr2-save[hidden] {
  display: none;
}
