@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
}

/*
  Layout: one quiet column on phones; on desktop the form sits left and the
  QR "stage" sits right, so the page never jumps when the code appears.
  Ink on a cool off-white, one Pix-adjacent teal used only for state and focus.
*/
:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #0c1110;
  --muted: #5d6967;
  --line: #dce2e0;
  --accent: #0b7d70;
  --on-ink: #f4f6f5;
  --error: #b3261e;
  --sans: Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c1110;
    --surface: #131a19;
    --ink: #e6ecea;
    --muted: #8b9896;
    --line: #25302e;
    --accent: #3cc2b0;
    --on-ink: #0c1110;
    --error: #f2877d;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

[hidden] { display: none !important; }

button { font-family: inherit; cursor: pointer; }

main {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding-block: 48px 32px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.top {
  display: grid;
  gap: 32px;
}

.tool {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Intro ---------- */

.intro { margin-bottom: 32px; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  text-wrap: balance;
}

.lead {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

/* Generated state: keep the eyebrow and H1, drop the intro and the lock line. */
body:has(#result:not([hidden])) .lead,
body:has(#result:not([hidden])) #privacy-badge {
  display: none;
}

/* ---------- Key field ---------- */

form { display: flex; flex-direction: column; }

.key-field { position: relative; }

#key {
  width: 100%;
  height: 64px;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: normal;
  transition: border-color 150ms ease;
}

#key::placeholder {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  opacity: 0.7;
}

#key:focus { outline: none; border-bottom-color: var(--accent); }

#key:focus-visible { box-shadow: 0 2px 0 0 var(--accent); }

#key[aria-invalid="true"] { border-bottom-color: var(--error); }

.chip {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.key-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

#key-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
}

.choice-label {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.segment {
  display: flex;
  width: 100%;
  height: 44px;
  padding: 3px;
  border-radius: 10px;
  background: var(--line);
}

.segment-opt {
  position: relative;
  display: flex;
  flex: 1 1 50%;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.segment-opt input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segment-opt:has(input:checked) {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

.segment-opt:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

.error {
  margin: 10px 0 0;
  color: var(--error);
  font-size: 14px;
  line-height: 20px;
}

.error:empty { display: none; }

/* ---------- Buttons ---------- */

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity 150ms ease, transform 100ms ease;
}

.primary svg { display: block; flex: none; }

.primary:hover:not(:disabled) { opacity: 0.88; }

.primary:active:not(:disabled) { transform: scale(0.99); }

.primary:disabled {
  background: var(--line);
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  cursor: not-allowed;
}

#generate { margin-top: 24px; }

a.primary,
a.primary:visited {
  color: var(--on-ink);
  text-decoration: none;
  cursor: pointer;
}

a.primary[aria-disabled="true"],
a.primary[aria-disabled="true"]:hover,
a.primary[aria-disabled="true"]:active {
  background: var(--line);
  color: var(--muted);
  opacity: 1;
  transform: none;
  cursor: not-allowed;
}

.outline {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  transition: border-color 150ms ease;
}

.outline:hover { border-color: var(--muted); }

#reset { margin-top: 8px; }

.primary:focus-visible,
.outline:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.badge {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  /* One line on every iPhone; the full statement is further down the page. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- QR stage ---------- */

.stage { min-width: 0; }

.stage-empty { display: none; }

#result { display: flex; flex-direction: column; }

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  /* QR codes scan best dark-on-white, so the card stays white in dark mode. */
  background: #ffffff;
  color: #0c1110;
}

.card.fade { animation: qr-in 260ms cubic-bezier(0.2, 0.7, 0.2, 1); }

@keyframes qr-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

#qr {
  display: block;
  width: min(300px, 100%);
  height: auto;
  image-rendering: pixelated;
}

.key-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  font-variant-numeric: normal;
}

#wa-row { margin-top: 16px; }

#whatsapp { margin-top: 12px; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Content sections ---------- */

.how,
.faq,
.privacy {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.how h2,
.faq h2,
.privacy h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.how ol {
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how li {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

.step-num {
  flex: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.step-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.step-title { font-size: 16px; font-weight: 600; }

.step-line { color: var(--muted); font-size: 15px; }

.faq details { border-bottom: 1px solid var(--line); }

.faq details:first-of-type { border-top: 1px solid var(--line); }

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::marker { content: ""; }

.faq summary::after {
  content: "+";
  flex: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 400;
  transition: transform 150ms ease;
}

.faq details[open] > summary::after { transform: rotate(45deg); }

.faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.faq details p {
  max-width: 62ch;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.privacy h2 .shield { flex: none; width: 20px; height: 20px; color: var(--accent); }

.privacy .privacy-sub {
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
}

.privacy p {
  max-width: 62ch;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.privacy p:last-child { margin-bottom: 0; }

footer {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

footer p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

footer p + p { margin-top: 6px; }

footer a,
footer a:visited {
  color: inherit;
  text-underline-offset: 2px;
}

.domain {
  margin-right: 8px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

/* ---------- Toast, copy sink ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 2;
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transform: translateX(-50%);
  animation: qr-in 200ms ease;
}

.copy-sink {
  position: fixed;
  left: -9999px;
  top: 0;
}

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
  main { padding-block: 88px 40px; }

  .top {
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 80px;
    align-items: start;
  }

  h1 { font-size: 64px; }

  .lead { font-size: 15px; }

  .stage {
    position: sticky;
    top: 32px;
  }

  .stage-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    aspect-ratio: 1 / 1.08;
    max-width: 100%;
    border: 1px dashed var(--line);
    border-radius: 20px;
    color: var(--muted);
    font-size: 14px;
  }

  .stage-empty p { margin: 0; }

  .stage:has(#result:not([hidden])) .stage-empty { display: none; }

  /* Three finder squares: the one shape every QR code has. */
  .frame {
    position: relative;
    width: 120px;
    height: 120px;
  }

  .frame span {
    position: absolute;
    width: 36px;
    height: 36px;
    border: 6px solid var(--line);
    border-radius: 6px;
  }

  .frame span::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 2px;
    background: var(--line);
  }

  .frame span:nth-child(1) { top: 0; left: 0; }
  .frame span:nth-child(2) { top: 0; right: 0; }
  .frame span:nth-child(3) { bottom: 0; left: 0; }

  #qr { width: 100%; }

  .how ol { grid-template-columns: repeat(3, 1fr); gap: 32px; }

  .how li { flex-direction: column; gap: 10px; }

  .faq,
  .privacy {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    column-gap: 80px;
  }

  .how h2,
  .faq h2,
  .privacy h2 { grid-row: 1 / span 20; align-self: start; }

  .how { display: grid; grid-template-columns: 280px minmax(0, 1fr); column-gap: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
