:root {
  --black: #0A0A0A;
  --ink: #141414;
  --white: #FFFFFF;
  --paper: #FAF8F4;
  --gold: #C9A96E;
  --gold-deep: #8A6D36;   /* gold dark enough for text on white (AA) */
  --line: #E4DCCB;
  --muted: #4A4A4A;
  --warn-bg: #FFF4E0;
  --warn-ink: #7A3E00;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.55;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--black); color: var(--white); padding: 12px 18px; z-index: 10;
}
.skip:focus { left: 16px; top: 16px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px; }

/* Masthead */
.masthead {
  background: var(--black);
  color: var(--white);
  padding: 52px 0 46px;
  border-bottom: 3px solid var(--gold);
}
.eyebrow {
  margin: 0 0 6px;
  font-size: 16px; font-weight: 600;
  letter-spacing: .24em; text-transform: uppercase;
  color: var(--gold);
}
.masthead h1 {
  margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(44px, 6vw, 68px); line-height: 1.05;
}
.lede { margin: 16px 0 0; max-width: 46ch; font-size: 21px; color: #E9E6E0; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  grid-template-areas: "form preview" "tips preview";
  gap: 28px;
  padding-top: 36px; padding-bottom: 48px;
  align-items: start;
}
.form-panel { grid-area: form; }
.preview-panel { grid-area: preview; position: sticky; top: 20px; }
.tips { grid-area: tips; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 30px;
}
.panel h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: 32px; line-height: 1.2;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gold);
}
.second-h { margin-top: 40px !important; }

/* Form */
.field { margin-bottom: 18px; min-width: 0; }
.row { display: grid; gap: 0 18px; }
.row.two { grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: 1.4fr .8fr 1fr; }
label { display: block; font-weight: 600; font-size: 18px; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=tel], input[type=email], input[type=url] {
  width: 100%;
  font: inherit; font-size: 20px;
  padding: 13px 14px;
  border: 1.5px solid #BDB6A8;
  border-radius: 3px;
  background: var(--white); color: var(--ink);
  min-height: 54px;
}
input::placeholder { color: #8C8C8C; }
input:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible, .check input:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
input[type=text]:focus, input[type=tel]:focus, input[type=email]:focus, input[type=url]:focus { border-color: var(--black); }

fieldset.optional {
  border: 1px solid var(--line); border-radius: 3px;
  padding: 16px 18px 4px; margin: 6px 0 22px;
}
legend {
  font-family: var(--serif); font-size: 22px; font-weight: 600; padding: 0 8px;
}
.color-pair { display: flex; gap: 12px; align-items: center; }
input[type=color] {
  width: 64px; height: 54px; padding: 4px;
  border: 1.5px solid #BDB6A8; border-radius: 3px; background: var(--white); cursor: pointer;
}
#colorText { max-width: 170px; text-transform: uppercase; font-family: Consolas, "Courier New", monospace; }
.hint { margin: 6px 0 0; font-size: 17px; color: var(--muted); }
.warn {
  background: var(--warn-bg); color: var(--warn-ink);
  border-left: 4px solid #C26A00;
  padding: 12px 14px; margin: 0 0 16px; font-size: 18px; font-weight: 500;
}
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; margin-bottom: 16px; cursor: pointer; }
.check input { width: 26px; height: 26px; margin: 2px 0 0; accent-color: var(--black); flex: none; }

/* Buttons */
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.btn {
  font: inherit; font-size: 18px; font-weight: 600; letter-spacing: .03em;
  padding: 14px 22px; min-height: 54px;
  border-radius: 3px; cursor: pointer;
  background: var(--black); color: var(--white); border: 2px solid var(--black);
}
.btn:hover { background: #262626; border-color: var(--gold); }
.btn.outline { background: var(--white); color: var(--black); border-color: var(--gold); }
.btn.outline:hover { background: #FBF6EC; }
.btn.ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); font-weight: 500; }
.btn.ghost:hover { color: var(--black); border-color: var(--black); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Preview */
.qr-card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 18px 18px 12px;
  text-align: center;
}
.qr-box { width: 100%; max-width: 380px; margin: 0 auto; aspect-ratio: 1 / 1; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-box .empty {
  height: 100%; display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--line); color: var(--muted); font-size: 18px; padding: 20px;
}
.qr-caption {
  margin: 8px 0 4px; font-weight: 600; font-size: 20px; letter-spacing: .02em; color: var(--black);
}
.status { margin: 10px 0 0; font-size: 17px; color: var(--muted); min-height: 1.5em; }
.status.bad { color: var(--warn-ink); font-weight: 600; }

details.raw { margin-top: 16px; }
details.raw summary { cursor: pointer; font-weight: 600; font-size: 17px; color: var(--gold-deep); }
details.raw pre {
  background: #F4F1EA; padding: 14px; font-size: 15px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-all; margin: 10px 0 0;
}

/* Tips */
.tips ol { padding-left: 24px; margin: 0; }
.tips li { margin-bottom: 14px; }
.explain { margin-top: 22px; padding: 20px 22px; background: var(--black); color: #EEEAE2; border-radius: 3px; }
.explain h3 { font-family: var(--serif); font-size: 25px; margin: 0 0 10px; color: var(--gold); font-weight: 600; }
.explain p { margin: 0 0 12px; }
.explain strong { color: var(--white); }

/* Footer */
.foot { background: var(--black); color: #D9D5CC; padding: 34px 0 40px; border-top: 3px solid var(--gold); text-align: center; }
.foot p { margin: 6px 0; }
.foot .brand { font-family: var(--serif); font-size: 22px; color: var(--white); }
.foot a { color: var(--gold); font-weight: 600; }
.foot .fine { font-size: 14px; color: #A8A399; margin-top: 14px; }

/* Responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "form" "preview" "tips"; }
  .preview-panel { position: static; }
}
@media (max-width: 560px) {
  body { font-size: 18px; }
  .wrap { padding: 0 16px; }
  .masthead { padding: 36px 0 32px; }
  .lede { font-size: 19px; }
  .panel { padding: 22px 18px; }
  .panel h2 { font-size: 28px; }
  .row.two, .row.three { grid-template-columns: 1fr; }
  .btns .btn { flex: 1 1 100%; }
  fieldset.optional { padding: 12px 12px 2px; }
}
