:root {
  color-scheme: light;
  --ink: #192536;
  --muted: #536071;
  --orange: #e87516;
  --line: #dedfe2;
  --surface: #fff;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { background: #f8f6f3; }
.wrap { width: min(100% - 2rem, 68rem); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid #e9e3dd; }
.header-inner, .brand, .site-footer { display: flex; align-items: center; gap: .75rem; }
.header-inner { min-height: 4.6rem; justify-content: space-between; }
.brand { font-weight: 750; }
.brand img { object-fit: contain; flex: none; }
.home-link, .site-footer a { color: #793503; text-underline-offset: .18em; }
.home-link { white-space: nowrap; font-size: .875rem; }
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(9rem, 25vw, 20rem);
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  padding: clamp(1.75rem, 3vw, 2.75rem) 0 1.4rem;
}
.intro-art { display: block; width: 100%; height: auto; }
.eyebrow { margin: 0 0 .4rem; color: #8b3c04; font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
h1 { margin: 0; font-size: clamp(1.9rem, 4.6vw, 3.25rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { margin: 0 0 .8rem; font-size: 1.25rem; line-height: 1.2; }
.intro-copy > p:last-child { color: var(--muted); margin: .75rem 0 0; }
#generator { display: block; width: 100%; height: 36rem; border: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 1rem; }
.card, .privacy, .instructions { border: 1px solid #e8e0d9; border-radius: 1.15rem; }
.card { background: var(--surface); padding: clamp(1rem, 3vw, 1.8rem); min-width: 0; }
.fields { border-top: 4px solid var(--orange); }
.result { background: #fffdf9; }
fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
label { display: block; font-size: .9rem; font-weight: 700; margin: .85rem 0 .32rem; }
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]), select {
  width: 100%;
  min-width: 0;
  min-height: 2.85rem;
  border: 1px solid #adb2b9;
  border-radius: .6rem;
  padding: .55rem .7rem;
  background: #fff;
}
input[aria-invalid=true] { border-color: #ae2a24; }
.password-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
.check { display: flex; align-items: center; gap: .55rem; width: fit-content; margin-block: 1rem; min-height: 2rem; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: #a64808; margin: 0; flex: none; }
button { border: 1px solid transparent; border-radius: .65rem; padding: .55rem .85rem; font-weight: 720; min-height: 2.75rem; cursor: pointer; }
button:disabled { opacity: .53; cursor: default; }
input:disabled { background: #f4f3f0; }
.primary { background: var(--orange); color: #17120d; }
.primary:not(:disabled):hover { background: #f08e36; }
.secondary, .reveal { background: #fff; border-color: #c7c9ce; }
.secondary:not(:disabled):hover, .reveal:not(:disabled):hover { background: #f8f2eb; }
:focus-visible { outline: 3px solid #894008; outline-offset: 3px; }
.qr-stage { display: grid; place-items: center; width: min(100%, 16.25rem); aspect-ratio: 1; margin: 0 auto; }
.empty-preview { display: grid; place-items: center; width: 100%; height: 100%; border: 1px dashed #bcab9c; border-radius: .85rem; color: #7b6759; background: #f8f4ee; }
canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; background: #fff; }
.network-name, .status { text-align: center; overflow-wrap: anywhere; }
.network-name { margin: .55rem 0 0; font-weight: 750; }
.status { margin: .65rem 0; font-size: .86rem; color: var(--muted); }
.actions { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.field-error { margin: .25rem 0 0; color: #9f231e; font-size: .84rem; }
.privacy, .instructions { margin-top: 1rem; padding: clamp(1rem, 3vw, 1.6rem); }
.privacy { display: flex; align-items: flex-start; gap: .75rem; color: #174638; background: #edf6ef; border-color: #cddfd2; }
.privacy svg { flex: none; }
.privacy h2 { margin-bottom: .4rem; }
.privacy p, .instructions p { margin: .4rem 0 0; }
.instructions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; background: #fff; }
.instructions ol { margin: 0; padding-inline-start: 1.3rem; }
.instructions li + li { margin-top: .25rem; }
.instructions .share-note { grid-column: 1 / -1; background: #fff0ef; border-radius: .55rem; margin: 0; padding: .75rem; }
.site-footer { align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding-block: 1.25rem; font-size: .86rem; color: var(--muted); }
.copyright { flex: 1 1 30rem; }
.copyright p { margin: 0; }
.copyright p + p { margin-top: .35rem; }

@media (max-width: 43rem) {
  #generator { height: 57rem; }
  .workspace, .instructions { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
  .intro { display: block; padding-top: clamp(1.75rem, 4vw, 3.5rem); }
  .intro-art { display: none; }
  /* Keep the consent control outside the scrollable content. */
  html:has(> body.shell) { overflow: hidden; background: #f8f6f3; }
  .shell {
    height: calc(100vh - 64px - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 64px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }
  .shell #stcm-wrapper #stcm-icon {
    left: calc(12px + env(safe-area-inset-left, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

@media print {
  @page { margin: 16mm; }
  .generator .workspace { display: block; }
  .generator .fields, .generator .eyebrow, .generator .actions, .generator .status,
  .generator .empty-preview, .generator #result-heading { display: none !important; }
  .generator .result { border: 0; padding: 0; background: #fff; }
  .generator .qr-stage { width: min(70mm, 100%); }
  .generator .network-name { color: #000; }
}
