/* ------------------------------------------------------------------
   QR Code Generator page
   Layered on top of css/styles.css; relies on its design tokens.
   ------------------------------------------------------------------ */

.qr-hero {
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}
.qr-hero-inner { max-width: 720px; }
.qr-hero h1 { margin-bottom: 0.6rem; }
.qr-hero .lead { max-width: 60ch; }

.qr-tool { padding-top: clamp(1.5rem, 3vw, 2.5rem); }

.qr-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
@media (max-width: 820px) {
  .qr-grid { grid-template-columns: 1fr; }
}

/* ---- Left pane: content input ---- */
.qr-form-pane {
  background: rgba(244, 239, 230, 0.04);
  border: 1px solid rgba(244, 239, 230, 0.1);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
}

.qr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(244, 239, 230, 0.1);
}
.qr-tab {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid rgba(244, 239, 230, 0.15);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  min-height: 40px;
}
.qr-tab:hover { border-color: rgba(244, 239, 230, 0.35); color: var(--cream); }
.qr-tab.is-active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.qr-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 115, 27, 0.3);
}

.qr-panel { animation: qrFade 0.25s ease; }
.qr-panel[hidden] { display: none; }
@keyframes qrFade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* select follows the same visual language as .field input */
.qr-form-pane select,
.qr-options select {
  font: inherit;
  font-family: var(--font-body);
  color: var(--cream);
  background: rgba(22, 17, 15, 0.6);
  border: 1.5px solid rgba(244, 239, 230, 0.15);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  min-height: 48px;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23b9b0a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.6rem;
}
.qr-form-pane select:focus-visible,
.qr-options select:focus-visible {
  outline: none;
  border-color: var(--orange);
  background-color: rgba(22, 17, 15, 0.85);
  box-shadow: 0 0 0 3px rgba(245, 115, 27, 0.25);
}
.qr-form-pane select option,
.qr-options select option { background: var(--bg); color: var(--cream); }

.field-hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.qr-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--cream);
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
  padding: 0.4rem 0;
}
.qr-check input[type="checkbox"] {
  accent-color: var(--orange);
  width: 18px; height: 18px;
}

.qr-options {
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(244, 239, 230, 0.1);
}
.qr-options-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--peri);
  margin-bottom: 1rem;
}

/* ---- Colour pickers ---- */
.qr-color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.color-input {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(22, 17, 15, 0.6);
  border: 1.5px solid rgba(244, 239, 230, 0.15);
  border-radius: 12px;
  padding: 0.4rem 0.5rem 0.4rem 0.5rem;
  min-height: 48px;
  transition: border-color 0.2s, background 0.2s;
}
.color-input:focus-within {
  border-color: var(--orange);
  background: rgba(22, 17, 15, 0.85);
  box-shadow: 0 0 0 3px rgba(245, 115, 27, 0.25);
}
.color-input input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
}
.color-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(244, 239, 230, 0.2); border-radius: 8px; }
.color-input input[type="color"]::-moz-color-swatch { border: 1px solid rgba(244, 239, 230, 0.2); border-radius: 8px; }
.color-swatch-label {
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--cream);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---- Contrast warning ---- */
.qr-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: rgba(229, 72, 77, 0.1);
  border: 1px solid rgba(229, 72, 77, 0.3);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  color: #ffb8ba;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}
.qr-warning[hidden] { display: none; }

/* ---- Logo upload ---- */
.qr-logo-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.qr-logo-trigger { cursor: pointer; }
.qr-logo-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(22, 17, 15, 0.6);
  border: 1.5px solid rgba(244, 239, 230, 0.15);
  border-radius: 10px;
  padding: 0.3rem 0.3rem 0.3rem 0.5rem;
}
.qr-logo-preview[hidden] { display: none; }
.qr-logo-preview img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  display: block;
}
.qr-logo-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.qr-logo-remove:hover { background: rgba(244, 239, 230, 0.1); color: var(--cream); }
.qr-logo-remove:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---- Right pane: preview + download ---- */
.qr-preview-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  position: sticky;
  top: 100px;
}
@media (max-width: 820px) {
  .qr-preview-pane { position: static; }
}

.qr-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
#qr-canvas {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.qr-canvas-wrap.is-empty #qr-canvas { visibility: hidden; }

.qr-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a8177;
  font-family: var(--font-head);
  font-size: 0.95rem;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}
.qr-canvas-wrap:not(.is-empty) .qr-placeholder { display: none; }

#qr-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.qr-meta {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ---- "Why we built this" cream band ---- */
.qr-why {
  text-align: center;
}
.qr-why .container { max-width: 720px; }
.qr-why p { color: #4a3f36; }
.qr-why a { color: var(--orange); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .qr-panel { animation: none; }
}
