:root {
  --linen: #f2e8d8;
  --linen-deep: #e8dbc6;
  --paper: #fffaf1;
  --ink: #221c16;
  --muted: #6f6253;
  --line: #cdbb9f;
  --line-soft: #e2d4bf;
  --thread: #b83b1f;
  --thread-dark: #8f2d16;
  --indigo: #2f4858;
  --saffron: #c58a1a;
  --sage: #5f7d5a;
  --cream: #fff6e6;
  --radius: 10px;
  --max: 1080px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  background-color: var(--linen);
  background-image:
    repeating-linear-gradient(0deg, rgba(110, 80, 50, .035) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(110, 80, 50, .035) 0 1px, transparent 1px 4px);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--thread); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
.wrap { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

header.site {
  border-bottom: 1px dashed var(--line);
  background: rgba(242, 232, 216, .92);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
header.site .wrap { display: flex; align-items: center; gap: 1rem; min-height: 66px; }
.logo {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--display); font-weight: 700; font-size: 1.3rem;
  letter-spacing: -.03em; color: var(--ink); text-decoration: none;
}
.logo svg { width: 28px; height: 28px; flex: 0 0 28px; }
.logo .wordmark > span { color: var(--thread); }
nav { margin-left: auto; display: flex; gap: 1.1rem; flex-wrap: wrap; }
nav a { color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 700; letter-spacing: .01em; }
nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-style: dashed; text-underline-offset: 5px; }

main { padding: 2.6rem 0 4.5rem; }

.hero { padding: 1.2rem 0 1.8rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 2.2rem; align-items: center; }
.hero-art {
  background: var(--paper);
  border: 2px dashed var(--line);
  border-radius: 18px;
  padding: 1rem;
  transform: rotate(1.2deg);
  box-shadow: 5px 6px 0 rgba(120, 90, 60, .08);
}
.hero-art svg { display: block; width: 100%; height: auto; }
.hero-art .caption {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); text-align: center; margin: .6rem 0 .2rem;
}

.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .71rem; font-weight: 800; color: var(--thread); }
h1, h2 {
  font-family: var(--display);
  line-height: 1.06;
  letter-spacing: -.035em;
  margin: .5rem 0 .9rem;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); max-width: 850px; text-wrap: balance; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); margin: 2.6rem 0 .8rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
p { max-width: 70ch; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 64ch; }
.small { font-size: .86rem; color: var(--muted); }
.mono { font-family: var(--mono); }
.code { font-family: var(--mono); background: #f6e2d4; color: var(--thread-dark); padding: .12rem .38rem; border-radius: 4px; font-weight: 700; font-size: .92em; }

.stitch-divider {
  height: 2px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 15px);
  margin: 2.4rem 0;
}

.searchbox { display: flex; gap: .6rem; margin: 1.4rem 0 .5rem; max-width: 660px; }
.searchbox input {
  flex: 1; min-width: 0;
  border: 1.5px dashed var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: .85rem 1rem;
  font: inherit; color: var(--ink);
}
.searchbox input:focus { outline: 2px solid var(--thread); outline-offset: 1px; }
.searchbox button {
  border: 0; border-radius: 8px; padding: .85rem 1.15rem;
  background: var(--indigo); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 3px 3px 0 rgba(47, 72, 88, .18);
}
.searchbox button:hover { background: #223640; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card {
  background: var(--paper);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: 3px 3px 0 rgba(120, 90, 60, .06);
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.stat { font-family: var(--display); font-size: 2.2rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.stat-label { color: var(--muted); font-size: .84rem; }

table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--paper); border: 1.5px dashed var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .72rem .8rem; border-bottom: 1px dashed var(--line-soft); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); background: var(--linen-deep); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fff4e2; }
td.code-cell { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
td.code-cell a { text-decoration: none; border-bottom: 2px dashed rgba(184, 59, 31, .35); }

.chip {
  display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .02em;
  padding: .16rem .52rem; border-radius: 999px;
  background: var(--linen-deep); color: var(--muted);
  margin: 0 .25rem .25rem 0;
  border: 1px dashed rgba(111, 98, 83, .35);
}
.chip.error { background: #f8ddd2; color: var(--thread-dark); border-color: #e4b39f; }
.chip.stop { background: #f7e8bf; color: #7a5208; border-color: #e3c77e; }
.chip.message { background: #dde8d8; color: #365033; border-color: #b9cfb2; }
a.chip { text-decoration: none; }
a.chip:hover { border-style: solid; color: var(--thread-dark); }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-style: solid; }

.answer {
  position: relative;
  border: 2px dashed var(--thread);
  background: var(--cream);
  padding: 1rem 1.1rem 1rem 1.15rem;
  border-radius: 8px;
  margin: 1.2rem 0 1.8rem;
  box-shadow: 4px 4px 0 rgba(184, 59, 31, .07);
}
.answer > strong:first-child {
  display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--thread); margin-bottom: .35rem;
}
.note { background: #fff5d8; border: 1.5px dashed #d9b765; border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1.2rem 0; }
.warn { background: #fbe8e2; border: 1.5px dashed #d99a86; border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1.2rem 0; }
.ok { background: #eaf1e5; border: 1.5px dashed #a9c09f; border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1.2rem 0; }

.breadcrumb { font-size: .84rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0 1rem; }

.steps { list-style: none; padding: 0; margin: 1rem 0 1.4rem; counter-reset: step; }
.steps li { position: relative; padding-left: 3.1rem; margin: 0 0 1.1rem; min-height: 2rem; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 1.5px dashed var(--thread);
  color: var(--thread); background: var(--cream);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .82rem; font-weight: 700;
}
.steps li::after {
  content: ""; position: absolute; left: 1rem; top: 2.05rem; bottom: -1.1rem;
  border-left: 1.5px dashed var(--line);
}
.steps li:last-child::after { display: none; }

.source { font-size: .85rem; color: var(--muted); border-top: 1.5px dashed var(--line); margin-top: 2rem; padding-top: 1rem; }
.related { display: flex; flex-wrap: wrap; gap: .5rem; }
.related a {
  background: var(--paper); border: 1.5px dashed var(--line);
  border-radius: 999px; padding: .3rem .68rem;
  text-decoration: none; font-family: var(--mono); font-size: .8rem;
}
.related a:hover { border-color: var(--thread); color: var(--thread-dark); }

details { border-bottom: 1px dashed var(--line); padding: .7rem 0; }
details:last-child { border-bottom: 0; }
summary { cursor: pointer; font-weight: 700; }
summary:hover { color: var(--thread); }
details p { margin: .55rem 0 0; color: var(--muted); }

footer.site {
  border-top: 1.5px dashed var(--line);
  padding: 2rem 0 2.2rem;
  color: var(--muted);
  font-size: .86rem;
  background: rgba(232, 219, 198, .35);
}
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }
footer.site strong { color: var(--ink); font-family: var(--display); }

.hidden { display: none !important; }
.kbd {
  font-family: var(--mono); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: .05rem .35rem; font-size: .8em; background: var(--paper);
}

.thread-palette { display: flex; gap: .35rem; justify-content: center; margin-top: .4rem; }
.thread-palette span { width: 9px; height: 9px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.08); }

.button {
  display: inline-block;
  background: var(--thread);
  color: #fff;
  padding: .78rem 1.05rem;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(143, 45, 22, .18);
  white-space: nowrap;
}
.button:hover { background: var(--thread-dark); color: #fff; }
.button-light { background: var(--cream); color: var(--indigo); box-shadow: 3px 3px 0 rgba(0, 0, 0, .12); }
.button-light:hover { background: #fff; color: var(--indigo); }

.repair-ticket {
  position: relative;
  background: var(--paper);
  border: 2px dashed var(--thread);
  border-radius: 14px;
  padding: 1.15rem 1.25rem 1rem;
  margin: 2.2rem 0;
  box-shadow: 5px 6px 0 rgba(184, 59, 31, .08);
}
.repair-ticket::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  pointer-events: none;
}
.repair-ticket > * { position: relative; }
.ticket-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.ticket-no { font-family: var(--mono); font-size: .74rem; color: var(--muted); letter-spacing: .08em; }
.ticket-body { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ticket-body > div { flex: 1 1 320px; }
.repair-ticket h2 { margin: .35rem 0 .45rem; }
.repair-ticket p { margin: .4rem 0; }

.repair-strip {
  display: flex;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: var(--indigo);
  color: #fff;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1.6rem 0 2.2rem;
  box-shadow: 4px 4px 0 rgba(47, 72, 88, .16);
}
.repair-strip strong { color: #fff; }
.repair-strip div { max-width: 62ch; }

.repair-form {
  background: var(--paper);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.3rem;
  margin: 1.4rem 0 1.8rem;
  box-shadow: 4px 4px 0 rgba(120, 90, 60, .06);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .82rem; font-weight: 800; letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px dashed var(--line);
  background: var(--cream);
  border-radius: 8px;
  padding: .68rem .75rem;
  font: inherit;
  color: var(--ink);
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
  background: #fff;
}
.field.full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 1.1rem; }
.form-actions p { margin: 0; max-width: 44ch; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .feedback-pair { grid-template-columns: 1fr; }
  .ticket-body .button, .repair-strip .button { width: 100%; text-align: center; }
}

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 360px; transform: rotate(.8deg); }
}
@media (max-width: 640px) {
  main { padding-top: 1.4rem; }
  header.site .wrap { min-height: 0; padding: .55rem 0 .5rem; flex-wrap: wrap; }
  header.site .logo { order: 1; }
  header.site nav { order: 2; width: 100%; margin-left: 0; gap: .55rem; }
  nav a { font-size: .8rem; }
  .searchbox { flex-direction: column; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}

/* --- feedback, guides, printable sheets ---------------------------------- */
.feedback {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1.6rem 0;
  background: var(--paper);
}
.feedback > strong { display: block; font-size: 1.05rem; }
.feedback[hidden] { display: none; }
.feedback-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .55rem; }
.feedback-detail { margin-top: .7rem; }
.feedback-detail summary { font-size: .82rem; color: var(--muted); }
.feedback-fields { display: grid; gap: .6rem; padding-top: .55rem; }
.feedback-fields label { display: block; font-size: .8rem; font-weight: 700; }
.feedback-fields input,
.feedback-fields textarea {
  width: 100%; padding: .6rem .7rem;
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: var(--cream); font: inherit;
}
.feedback-fields textarea { min-height: 4.5rem; resize: vertical; }
.feedback-fields input:focus,
.feedback-fields textarea:focus { outline: 2px solid var(--thread); outline-offset: 1px; background: #fff; }
.feedback-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.outcome-summary { margin-top: .75rem; border-top: 1px dashed var(--line-soft); padding-top: .55rem; }
.outcome-summary p { margin: .2rem 0; }
.outcome-badge {
  display: inline-block; margin-top: .25rem; padding: .12rem .55rem;
  border-radius: 999px; font-size: .72rem; font-weight: 800;
}
.outcome-badge.is-verified { background: #eaf1e5; color: #365033; border: 1px dashed #a9c09f; }
.outcome-badge.is-disputed { background: #fff5d8; color: #7a5208; border: 1px dashed #d9b765; }
.outcome-fix { color: var(--ink); }

.guide h2 { margin-top: 2rem; }
.guide ul, .guide ol { padding-left: 1.3rem; }
.guide li { margin: .35rem 0; }
.updates { list-style: none; padding: 0; }
.updates li { padding: .45rem 0; border-bottom: 1px dashed var(--line-soft); }
.cheat-sheet table { font-size: .86rem; }
.cheat-sheet th, .cheat-sheet td { padding: .4rem .5rem; }
.print-foot { margin-top: 1rem; font-size: .72rem; color: var(--muted); }

@media print {
  header.site, footer.site, .repair-strip, .repair-ticket, .feedback,
  .skip, .no-print, .beacon { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .cheat-sheet h1 { font-size: 18pt; margin: 0 0 .3rem; }
  .cheat-sheet .lede { font-size: 9pt; }
  .cheat-sheet table { font-size: 8.5pt; border: 1px solid #000; }
  .cheat-sheet th, .cheat-sheet td { padding: 2px 4px; border-bottom: 1px solid #999; }
  .cheat-sheet tr { break-inside: avoid; }
  .print-foot { display: block; font-size: 7.5pt; }
}
