/* ============================================================
   QR Scanner (citizen camera-based QR check-in) page.
   Structure in @layer layout, paint in @layer design. Content-named
   classes only — no legacy/appearance names, no hardcoded color.
   Reuses .app-screen and .btn/.btn--primary/.btn--outline from
   elements.css. See docs/FRONTEND-ARCHITECTURE.md.
   ============================================================ */

@layer layout {

  /* Viewfinder: the live camera feed with a centred scan frame and a
     caption pinned to the bottom. A positioned stack — the feed fills it,
     the frame and instruction sit on top. */
  .viewfinder {
    position: relative;
    inline-size: 100%;
    aspect-ratio: 3 / 4;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: var(--mea-radius-3xl);
  }
  @container (min-width: 28rem) { .viewfinder { aspect-ratio: 1 / 1; } }

  .viewfinder__feed {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
  }

  .viewfinder__frame {
    position: relative;
    inline-size: 60%;
    aspect-ratio: 1 / 1;
    border-radius: var(--mea-radius-xl);
  }

  .viewfinder__instruction {
    position: absolute;
    inset-block-end: var(--mea-space-5);
    inset-inline: var(--mea-space-5);
    margin: 0;
    padding: var(--mea-space-2) var(--mea-space-4);
    border-radius: var(--mea-radius-pill);
    text-align: center;
  }

  /* Off-screen scratch canvas used for frame capture/decoding. */
  .qr-scanner__buffer { display: none; }

  .scan-retry { align-self: center; }

  /* Capture controls: shutter button stacked over a hint line. */
  .capture { display: grid; gap: var(--mea-space-2); justify-items: center; }
  .capture__shutter {
    display: inline-flex; align-items: center; justify-content: center;
    inline-size: 4.5rem; block-size: 4.5rem; padding: var(--mea-space-1);
    border: 0; border-radius: var(--mea-radius-circle); cursor: pointer;
  }
  .capture__shutter-ring {
    inline-size: 100%; block-size: 100%; border-radius: var(--mea-radius-circle);
  }
  .capture__hint { margin: 0; text-align: center; }
}

@layer design {
  .viewfinder { background: var(--t-bg-recessed); box-shadow: var(--mea-shadow-sm); }
  .viewfinder__frame { border: 3px solid var(--t-accent); box-shadow: var(--mea-shadow-md); }
  .viewfinder__instruction {
    background: var(--t-bg-active); color: var(--t-text);
    font-size: var(--mea-text-sm); font-weight: var(--mea-w-semibold);
  }

  .capture__shutter { background: transparent; border: 3px solid var(--t-border); }
  .capture__shutter:disabled { opacity: .5; cursor: default; }
  .capture__shutter:not(:disabled):active { opacity: .85; }
  .capture__shutter-ring {
    background: var(--t-accent);
    transition: background var(--mea-dur-fast);
  }
  .capture__shutter:not(:disabled):hover .capture__shutter-ring { background: var(--t-accent-hover); }
  .capture__hint { color: var(--t-text-secondary); font-size: var(--mea-text-sm); font-weight: var(--mea-w-semibold); }
}

/* ── Check-in pages (qr_scanner, qr_scanner_confirm, attend_confirm,
   attend_result). Each renders through pages/_participant_check_in.html, so
   the page is one raised work surface; the layout pads it top and bottom and
   the page pads its own content inline. Colour comes from the surface it sits
   on. ── */
@layer layout {
	.check-in {
		padding-inline: var(--t-space-5);

		& p {
			margin: 0;
		}

		/* The code the participant reads out. */
		& .checkin-code {
			display: grid;
			gap: var(--t-space-3);

			& header {
				display: grid;
				gap: var(--t-space-2);
			}

			& h2 {
				margin: 0;
				font-size: var(--t-font-size-lg);
			}

			& code.value {
				font-size: var(--t-font-size-hero);
			}
		}

		/* A scan's outcome: title, what happened, actions. Its alignment
		   comes from the focus column the check-in layout puts it in. */
		& .scan-result {
			display: grid;
			gap: var(--t-space-4);

			& form {
				display: grid;
				gap: var(--t-space-3);
			}

			& .name {
				font-size: var(--t-font-size-lg);
				font-weight: var(--t-font-weight-semibold);
			}

			& .help {
				font-size: var(--t-font-size-md);
				overflow-wrap: anywhere;
			}

			& .explain {
				max-inline-size: 34rem;
				font-size: var(--t-font-size-sm);
			}
		}
	}
}
