:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --ink: #1f1a17;
  --muted: #6b6159;
  --line: #e4d9c9;
  --red: #b3261e;
  --red-ink: #ffffff;
  --green: #1f5135;
  --gold: #c9a227;
  --error: #b3261e;
  --focus: #1f5135;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130f;
    --surface: #221c17;
    --ink: #f3ece2;
    --muted: #b5a99b;
    --line: #3a3129;
    --red: #e0574d;
    --red-ink: #17130f;
    --green: #7cc29a;
    --error: #ff8a80;
    --focus: #7cc29a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
}

main { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }

h1, h2 { font-family: var(--serif); line-height: 1.15; }
h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0.2em 0 0.4em; }
h2 { font-size: 1.6rem; margin: 2.2em 0 0.6em; }

a { color: var(--green); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* A knitted band: two rows of offset diamonds, the classic Fair Isle border. */
.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 28px 16px 24px; max-width: 720px; margin: 0 auto;
  background-image: repeating-linear-gradient(45deg, var(--red) 0 5px, transparent 5px 10px),
                    repeating-linear-gradient(-45deg, var(--green) 0 5px, transparent 5px 10px);
  background-size: calc(100% - 32px) 10px;
  background-position: center bottom;
  background-repeat: no-repeat;
}
.wordmark { font: 700 1.6rem var(--serif); color: var(--ink); text-decoration: none; }
.wordmark span { color: var(--red); }
.season-tag { font-size: 0.85rem; color: var(--muted); }

.site-footer { display: flex; gap: 20px; justify-content: center; padding: 24px 16px 40px; font-size: 0.9rem; }

.hero { padding: 24px 0 8px; }
.kicker { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; color: var(--muted); margin: 0; }
.lead { font-size: 1.15rem; }
.small, .hint { font-size: 0.88rem; color: var(--muted); }

.button {
  display: inline-block; background: var(--red); color: var(--red-ink); border: 0; border-radius: 999px;
  padding: 12px 24px; font: 600 1rem var(--sans); text-decoration: none; cursor: pointer;
}
.button:hover { filter: brightness(1.08); }

.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 0.6em; }

.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 12px; margin-top: 24px; }
.feature h2 { margin-top: 0.8em; font-size: 1.35rem; }

form label { display: block; margin: 14px 0 4px; font-weight: 600; }
form .hint { font-weight: 400; }
input:not([type=checkbox], [type=radio]), select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
}
[aria-invalid="true"] { border-color: var(--error) !important; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: 5px; flex: none; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset.kind label { display: inline-flex; gap: 8px; margin-right: 20px; font-weight: 400; }
legend { font-weight: 600; margin-top: 8px; }
.error { display: block; color: var(--error); font-size: 0.9rem; }
.alert { border-left: 4px solid var(--error); padding: 8px 12px; background: var(--surface); }
.notice { border-left: 4px solid var(--green); padding: 8px 12px; background: var(--surface); }
form .button { margin-top: 22px; }

.code-row { display: flex; gap: 8px; margin-top: 6px; }
.code-row input { margin-top: 0 !important; text-transform: uppercase; letter-spacing: 0.15em; font-family: ui-monospace, Menlo, monospace; }
.code-row .button { margin-top: 0; flex: none; }

/* Company sign-ups do not pick a size: hide those fields without JavaScript. */
.signup:has(#kind-company:checked) .person-only { display: none; }

/* Honeypot: off screen for people, still in the form for bots. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }

.passport { display: grid; grid-template-columns: 140px 1fr; gap: 20px; align-items: center; padding-top: 24px; }
.sweater-photo { width: 140px; height: 140px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.sweater-photo.placeholder { background: repeating-linear-gradient(45deg, var(--red) 0 10px, var(--green) 10px 20px); opacity: 0.35; }
.passport h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.meta { margin: 2px 0; color: var(--muted); }
@media (max-width: 520px) { .passport { grid-template-columns: 1fr; } }

.stamps { list-style: none; padding: 0; }
.stamp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; }
.stamp-head { margin: 0; font-weight: 600; }
.stamp-no { color: var(--red); font-family: var(--serif); margin-right: 6px; }
.stamp time { display: block; font-weight: 400; font-size: 0.88rem; color: var(--muted); }
.story { font-family: var(--serif); font-size: 1.1rem; margin: 8px 0 4px; }
.wearer { margin: 0; color: var(--muted); font-size: 0.92rem; }
.stamp img { display: block; max-width: 100%; border-radius: 8px; margin-top: 10px; }
.empty { color: var(--muted); }
.stamp-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 20px; margin-top: 24px; }
.stamp-form h2 { margin-top: 0.8em; }

.legal h2 { font-size: 1.2rem; margin-top: 1.6em; }

/* Admin */
.admin main { max-width: 1200px; }
.admin h1 { font-size: 2rem; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.admin-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; align-items: end; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.muted { opacity: 0.5; }
form.inline { display: flex; gap: 6px; align-items: center; }
form.inline select { margin: 0; padding: 4px 6px; width: auto; max-width: 240px; }
form.inline button { padding: 4px 10px; }

/* Tag sheet: real sizes in millimetres, so print at 100%. */
.print-sheet main { max-width: 210mm; }
.sheet { display: grid; gap: 0; margin: 8mm 0; color: #000; background: #fff; }
.passport-tags { grid-template-columns: repeat(2, 85.6mm); }
.tag {
  position: relative; width: 85.6mm; height: 54mm; display: flex; gap: 4mm; align-items: center;
  padding: 5mm; border: 0.2mm dashed #999; break-inside: avoid;
}
.tag .qr { width: 38mm; height: 38mm; flex: none; }
.tag .qr svg, .label .qr svg { width: 100%; height: 100%; display: block; }
.tag-text { display: flex; flex-direction: column; gap: 1.5mm; font: 9pt/1.25 var(--sans); }
.tag-brand { font: 700 11pt var(--serif); }
.tag-brand b { color: #b3261e; }
.tag-name { font: 600 10pt var(--serif); }
.tag-code { font: 7pt ui-monospace, Menlo, monospace; word-break: break-all; }
.tag-code b { font-size: 11pt; letter-spacing: 0.1em; }
.punch { position: absolute; top: 3mm; right: 3mm; width: 3mm; height: 3mm; border: 0.2mm solid #999; border-radius: 50%; }
.backup-labels { grid-template-columns: repeat(6, 30mm); break-before: page; }
.label { width: 30mm; height: 34mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1mm; border: 0.2mm dashed #ccc; font: 7pt ui-monospace, Menlo, monospace; }
.label .qr { width: 22mm; height: 22mm; }

@page { size: A4; margin: 10mm; }
@media print {
  body { background: #fff; }
  .screen-only { display: none; }
  .sheet { margin: 0; }
}
