/* Pixel & Hoop
   Graph-paper page, ink outlines, hard offset shadows and flat colour blocks.
   Colour is used sparingly: the pattern previews are already busy, so the page
   stays paper-and-ink and lets each card borrow a tint from its own threads. */

@font-face {
  font-family: "Anton";
  src: url("/assets/fonts/anton-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fbf7ec;
  --card: #fffdf7;
  --ink: #1b1b1b;
  --muted: #5f574f;
  --grid: rgba(27, 27, 27, 0.065);
  --yellow: #ffd23f;
  --blue: #2452c9;
  --pink: #f8b4cf;
  --green: #bfe06e;
  --sky: #c9dff5;
  --line: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 16px;
  --display: "Anton", "Arial Narrow Bold", "Helvetica Neue Condensed Bold", Impact, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

a:focus-visible, .button:focus-visible, button:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

h1, h2, .brand, .card-title, .price, .wordmark {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2.3rem, 9.5vw, 4rem);
  line-height: 0.98;
  margin: 0 0 0.9rem;
}

h2 {
  font-size: clamp(1.7rem, 6.5vw, 2.5rem);
  line-height: 1.02;
  margin: 0 0 1rem;
}

p { margin: 0 0 1rem; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

main.wrap { padding-top: 26px; padding-bottom: 72px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- header -------------------------------------------------------------- */
.site-header {
  background: var(--paper);
  border-bottom: var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 20px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font-size: 1.5rem;
  text-decoration: none;
}

/* The logo mark: a hoop with a cross-stitched heart (tools/make_brand.py). */
.brand::before {
  content: "";
  width: 36px;
  height: 36px;
  flex: none;
  background: url("/assets/brand/mark.svg") center / contain no-repeat;
}

.site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  margin: 0 0 0 -10px;
  padding: 0;
  list-style: none;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.site-header nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

.site-header nav a[aria-current="page"] {
  box-shadow: inset 0 0 0 2px var(--ink);
  background: var(--card);
}

/* ---- home hero ----------------------------------------------------------- */
.hero {
  position: relative;
  padding: 26px 0 8px;
  text-align: center;
}

.hero h1 { font-size: clamp(3rem, 15vw, 6rem); line-height: 0.92; margin-bottom: 1rem; }

.lede {
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.hero .lede {
  margin-left: auto;
  margin-right: auto;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.sticker {
  display: inline-block;
  margin: 0 0 16px;
  padding: 7px 16px;
  border: var(--line);
  border-radius: 999px;
  background: var(--green);
  box-shadow: var(--shadow-sm);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(-3deg);
}

.pills {
  margin: 14px -16px 36px;
  padding: 12px 16px;
  border-top: var(--line);
  border-bottom: var(--line);
  background: var(--card);
}

.pills ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pills a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: var(--line);
  border-radius: 999px;
  background: var(--sky);
  font-family: var(--display);
  font-size: 1.15rem;
  text-decoration: none;
}

.pills li:nth-child(4n + 2) a { background: var(--yellow); }
.pills li:nth-child(4n + 3) a { background: var(--pink); }
.pills li:nth-child(4n + 4) a { background: var(--green); }
.pills a:hover { box-shadow: var(--shadow-sm); transform: translate(-1px, -1px); }

/* Difficulty row sits right under the theme pills. */
.pills-levels { margin-top: -36px; border-top: 0; }
.pills-levels a { background: var(--paper); }
.pills-levels li:nth-child(n) a { background: var(--paper); }
.count {
  display: inline-block;
  min-width: 1.6em;
  margin-left: 6px;
  padding: 0 6px;
  border: var(--line);
  border-radius: 999px;
  background: var(--card);
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

/* ---- cards --------------------------------------------------------------- */
.theme-section { margin: 0 0 56px; }
.level-section { margin: 0 0 40px; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.answer figure { margin: 0; }
.answer-img { width: 100%; height: auto; image-rendering: pixelated; border: var(--line); border-radius: 10px; background: #fff; }
.answer figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 0.95rem; }
@media (min-width: 720px) { .answers { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.level-section h2 { display: flex; align-items: center; }

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--tint, var(--card));
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }

.card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border: var(--line);
  border-radius: 10px;
  background: #f4efe3;
}

.card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 10px 4px 6px;
}

.card-title { font-size: 1.3rem; line-height: 1.05; }

.card-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  margin-top: 3px;
  padding: 3px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
}

.badge-free { background: var(--green); }
.badge-pack { background: var(--card); }

/* ---- links and buttons --------------------------------------------------- */
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.text-link::after { content: "→"; margin-left: 8px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0 26px;
  border: var(--line);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

a.button:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
a.button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.button-off {
  border-style: dashed;
  background: var(--card);
  box-shadow: none;
  color: var(--muted);
}

/* The second choice next to a yellow button. */
.button-alt { background: var(--card); }

/* ---- pattern page -------------------------------------------------------- */
.pattern-top { display: grid; gap: 22px; margin-bottom: 34px; }

.preview {
  margin: 0;
  padding: 10px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.preview img { width: 100%; border: var(--line); border-radius: 10px; }

.preview figcaption {
  padding-top: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  text-align: center;
}

.download { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 22px; }

.specs {
  margin: 0;
  padding: 2px 16px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.specs div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  padding: 11px 0;
  border-bottom: 1.5px dashed rgba(27, 27, 27, 0.3);
}

.specs div:last-child { border-bottom: 0; }

.specs dt { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); align-self: center; }
.specs dd { margin: 0; font-weight: 700; }

.chart {
  max-width: 560px;
  margin: 0 auto 36px;
  border: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.threads {
  width: 100%;
  margin: 0 0 36px;
  border: var(--line);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: var(--card);
  font-size: 0.95rem;
}

.threads th, .threads td {
  padding: 9px 10px;
  border-bottom: 1.5px dashed rgba(27, 27, 27, 0.3);
  text-align: left;
  vertical-align: middle;
}

.threads tbody tr:last-child th, .threads tbody tr:last-child td { border-bottom: 0; }

.threads thead th {
  border-bottom: var(--line);
  background: var(--sky);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.threads tbody th { white-space: nowrap; }
.threads .num { text-align: right; font-family: var(--mono); }
.swatch-cell { width: 44px; }
.swatch rect { stroke: var(--ink); stroke-width: 1.5; }

/* The pack box: on the theme page, and on every pattern page (.pack-pattern,
   with a sentence above the price and a link to the theme below the button). */
.pack {
  margin: 44px 0 30px;
  padding: 20px 18px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--yellow);
  box-shadow: var(--shadow);
}

.pack .button { background: var(--ink); color: var(--card); box-shadow: 3px 3px 0 rgba(27, 27, 27, 0.35); }
button.button { font: inherit; cursor: pointer; }
button.button[disabled] { cursor: progress; opacity: 0.7; }
.bundle { background: var(--pink); }
/* Book covers are 2:3 portraits. */
.book-card .card-img { aspect-ratio: 2 / 3; object-fit: cover; }
.book .preview img { width: 100%; height: auto; border: var(--line); border-radius: 10px; }
.pack .button-off { background: var(--card); color: var(--muted); box-shadow: none; }
.pack-pattern h2 { font-size: clamp(1.6rem, 6vw, 2.1rem); margin-bottom: 0.6rem; }
.pack-intro { margin-bottom: 0.9rem; }
.pack-more { margin: 10px 0 0; }

/* In the column beside the preview, where the download button would be. */
.pack-stacked { margin: 0 0 22px; }
.pack-stacked .button { width: 100%; }

.pack-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.price { font-size: 2.4rem; line-height: 1; }

.more { margin-top: 44px; }

.prose {
  max-width: 44rem;
  padding: 24px 18px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

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

/* ---- accounts: sign-in forms, account page, claim page ---------------- */
[hidden] { display: none !important; }

.notice {
  max-width: 44rem;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: var(--line);
  border-radius: 12px;
  background: var(--pink);
  font-size: 0.95rem;
}

.auth { display: grid; gap: 18px; max-width: 44rem; margin-top: 18px; }

.auth-form {
  padding: 18px 16px 20px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.auth-form h2, .auth-form h3 { font-size: clamp(1.4rem, 5.5vw, 1.8rem); margin: 0 0 0.7rem; }

.field { display: grid; gap: 4px; margin: 0 0 14px; }
.field label { font-weight: 800; font-size: 0.95rem; }

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;      /* 16px or more: phones do not zoom into the field */
}

.field input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.field-hint { color: var(--muted); font-size: 0.85rem; }

.form-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: var(--line);
  border-radius: 12px;
  background: var(--pink);
  font-size: 0.95rem;
  font-weight: 600;
}

button.button { cursor: pointer; font-family: inherit; }
button.button:disabled { border-style: dashed; color: var(--muted); box-shadow: none; cursor: default; }

/* "Forgot your password?": a button that reads like a link. */
.form-aside { margin: -6px 0 12px; }

.link-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.link-button:disabled { color: var(--muted); cursor: default; }

.form-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: var(--line);
  border-radius: 12px;
  background: var(--green);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Password reset and email confirmation pages. */
.recovery-form { max-width: 44rem; margin: 0 0 24px; }
.recovery-working { color: var(--muted); }
.recovery-retry { margin: 0 0 24px; }

/* The account page's "Please verify your email". */
.account-verify { background: var(--sky); }
.account-verify p { margin: 0 0 10px; }
.account-verify p:last-child { margin-bottom: 0; }
.account-verify-status { font-weight: 700; }

.account h1, .claim h1, .reset h1, .verify h1 { font-size: clamp(2.2rem, 10vw, 3.4rem); margin-bottom: 0.8rem; }
.account-who { display: grid; gap: 10px; max-width: 44rem; margin: 0 0 26px; }
.account-who p { margin: 0; overflow-wrap: anywhere; }
.account-section { max-width: 44rem; margin: 0 0 30px; }
.account-section h2 { font-size: clamp(1.6rem, 6vw, 2.1rem); }
.account-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }

.account-item {
  padding: 12px 16px 14px;
  border: var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.account-item > a, .account-item-title a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 800;
}

.account-item-title { margin: 0; }
.account-item-meta { margin: 6px 0 0; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.account-sublist { margin: 4px 0 0; padding: 0; list-style: none; }
.account-sublist a { display: inline-flex; align-items: center; min-height: 44px; }

.account-meter {
  height: 12px;
  margin-top: 4px;
  overflow: hidden;
  border: var(--line);
  border-radius: 999px;
  background: #fff;
}

.account-meter-fill { display: block; height: 100%; background: var(--green); }
.account-empty { color: var(--muted); }
.claim-step, .recovery-step { max-width: 44rem; margin: 0 0 24px; }
.claim-step h2, .recovery-step h2 { font-size: clamp(1.6rem, 6vw, 2.1rem); }
.claim-actions { display: grid; gap: 12px; }

@media (min-width: 600px) {
  .account-who { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .claim-actions { display: flex; flex-wrap: wrap; }
  .account-verify .button, .recovery-retry { width: auto; }
}

@media (min-width: 900px) {
  .auth { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; align-items: start; }
}

/* ---- footer -------------------------------------------------------------- */
.site-footer {
  overflow: hidden;
  border-top: var(--line);
  border-radius: 28px 28px 0 0;
  background: var(--blue);
  color: #f4f1e6;
  font-size: 0.9rem;
}

.site-footer .wrap { padding-top: 30px; padding-bottom: 6px; }

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-right: 18px;
  font-weight: 700;
}

.wordmark {
  margin: 0 0 -0.14em;
  padding: 0 12px;
  color: var(--yellow);
  font-size: clamp(2.4rem, 14.5vw, 11.5rem);
  line-height: 0.86;
  white-space: nowrap;
  text-align: center;
}

.footer-themes ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
  margin: 0 0 14px;
  padding: 0 0 14px;
  list-style: none;
  border-bottom: 1px solid rgba(244, 241, 230, 0.35);
}

/* ---- wider screens ------------------------------------------------------- */
@media (min-width: 600px) {
  .wrap { padding: 0 24px; }
  .pills { margin-left: -24px; margin-right: -24px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .button { width: auto; }
  .pack { padding: 26px 28px; }
  .pack:not(.pack-stacked) { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 28px; }
  .pack:not(.pack-stacked) > * { grid-column: 1; margin-bottom: 0; }
  .pack:not(.pack-stacked) > .button { grid-column: 2; grid-row: 1 / span 2; }
  .pack-pattern:not(.pack-stacked) > .button { grid-row: 1 / span 3; }
  .pack:not(.pack-stacked) > .pack-more { margin-top: 0; }
  .pack:not(.pack-stacked) .pack-meta { justify-content: flex-start; gap: 18px; }
}

@media (min-width: 820px) {
  .pattern-top { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 36px; align-items: start; }
}

@media (min-width: 900px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pills { margin-left: 0; margin-right: 0; border: var(--line); border-radius: 999px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .button, .pills a { transition: none; }
  .card:hover, a.button:hover, a.button:active, .pills a:hover { transform: none; }
}

/* ==========================================================================
   Stitch tracker  (/patterns/<slug>/tracker/, every pattern; needs an account)
   Markup: sitegen.tracker_page. Behaviour: tracker-core.js and tracker.js.
   The thread list is built by tracker.js.
   Keep this section last: the generator appends the .tint-* rules after it.
   ========================================================================== */
.tracker h1 { font-size: clamp(1.9rem, 8vw, 3rem); margin-bottom: 0.6rem; }
.tracker h2 { font-size: clamp(1.5rem, 5.5vw, 2rem); margin-bottom: 0.4rem; }
.tracker-intro { max-width: 44rem; margin-bottom: 0.2rem; color: var(--muted); }
.tracker-links { margin-bottom: 0.6rem; }
.tracker-links .text-link::after { content: none; }
.tracker-links .text-link::before { content: "\2190"; margin-right: 8px; }

.tracker [hidden] { display: none; }

.tracker-gate, .tracker-locked { margin-top: 18px; }
.tracker-gate > p, .tracker-locked > p { max-width: 44rem; }
.tracker-locked .pack { margin-top: 18px; }
.tracker-loading { margin-top: 18px; font-weight: 700; }

/* "Saved" / "Saving..." beside the progress meter. */
.tracker-save {
  flex: none;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.tracker-save[data-status="retrying"], .tracker-save[data-status="refused"],
.tracker-save[data-status="signedOut"] { color: var(--ink); font-weight: 800; }

.tracker-import {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: var(--line);
  border-radius: 12px;
  background: var(--green);
}

.tracker-import p { grid-column: 1 / -1; margin: 0; font-weight: 700; }

.tracker-notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: var(--line);
  border-radius: 12px;
  background: var(--pink);
  font-size: 0.95rem;
}

/* Progress and tools stay in reach while the chart scrolls under them. */
.tracker-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -16px;
  padding: 8px 16px;
  border-bottom: var(--line);
  background: var(--paper);
}

.tracker-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 8px; }

.tracker-progress-text {
  flex: none;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.tracker-meter {
  flex: 1 1 60px;
  height: 12px;
  overflow: hidden;
  border: var(--line);
  border-radius: 999px;
  background: var(--card);
}

.tracker-meter-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 160ms ease;
}

.is-complete .tracker-meter-fill { background: var(--yellow); }

.tracker-toolbar { display: grid; gap: 8px; }
.tracker-tools, .tracker-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }

.tool, .thread-all {
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tool[aria-pressed="true"] { background: var(--yellow); box-shadow: var(--shadow-sm); }
.tool-zoom { font-family: var(--mono); font-size: 1.35rem; }
.tool-danger { background: var(--pink); }
.tool:disabled, .thread-all:disabled { border-style: dashed; color: var(--muted); cursor: default; }

.tracker-confirm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: var(--line);
  border-radius: 14px;
  background: var(--card);
}

.tracker-confirm p { grid-column: 1 / -1; margin: 0; font-weight: 700; }

.tracker-main { min-width: 0; margin-top: 14px; }

/* The chart scrolls inside this box, so a big chart never widens the page. */
.tracker-viewport {
  position: relative;
  max-width: 100%;
  max-height: calc(100vh - 200px);
  min-height: 200px;
  overflow: auto;
  border: var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

@supports (height: 100dvh) {
  .tracker-viewport { max-height: calc(100dvh - 200px); }
}

/* While Mark or Erase is on, a finger on the chart marks instead of scrolling
   the page; Move hands the gesture back to the browser, which scrolls the
   chart and, once the chart is at its edge, the page. */
.tracker-canvas {
  display: block;
  max-width: none;
  margin: 0 auto;
  cursor: crosshair;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.tracker-canvas:focus-visible { outline-offset: -3px; }
.is-erase .tracker-canvas { cursor: cell; }
.is-move .tracker-canvas { cursor: grab; touch-action: pan-x pan-y; }
.is-move.is-panning .tracker-canvas { cursor: grabbing; }

.tracker-help { margin: 12px 0 0; color: var(--muted); font-size: 0.85rem; }

.tracker-side { min-width: 0; margin-top: 30px; }
.tracker-filter { min-height: 2.6em; margin-bottom: 0.7rem; color: var(--muted); font-size: 0.9rem; }
.has-filter .tracker-filter { color: var(--ink); font-weight: 700; }

.tracker-threads { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.thread { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.thread-pick {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin: 0;
  padding: 6px 12px 6px 8px;
  border: var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.thread-pick[aria-pressed="true"] { background: var(--yellow); box-shadow: var(--shadow-sm); }
.has-filter .thread:not(.is-picked) .thread-pick { background: transparent; border-style: dashed; }

.thread-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  color: #1e1e1e;
  font-family: "Arial Unicode MS", "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "DejaVu Sans", sans-serif;
  font-size: 1.05rem;
  line-height: 1;
}

.thread-swatch.is-dark { color: #fff; }
.thread-label { min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }
.thread-number { display: block; font-weight: 800; }
.thread-name { display: block; color: var(--muted); font-size: 0.82rem; }
.thread-count { font-family: var(--mono); font-size: 0.78rem; white-space: nowrap; }
.thread.is-done .thread-count::after { content: " \2713"; }
.thread-all { max-width: 5.6rem; padding: 0 10px; border-radius: 14px; font-size: 0.78rem; }

@media (min-width: 600px) {
  .tracker-bar { margin: 0 -24px; padding: 10px 24px; }
  .tracker-toolbar { grid-template-columns: auto auto; justify-content: space-between; }
  .tracker-tools, .tracker-actions { grid-auto-columns: auto; }
  .tool { min-width: 76px; }
  .tool-zoom { min-width: 48px; }
  .tracker-confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
  .tracker-confirm p { margin-right: auto; }
  .tracker-viewport { max-height: calc(100vh - 124px); }
  .thread-all { max-width: none; }
}

@supports (height: 100dvh) {
  @media (min-width: 600px) {
    .tracker-viewport { max-height: calc(100dvh - 124px); }
  }
}

@media (min-width: 900px) {
  .tracker-app { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 0 28px; }
  .tracker-app > .tracker-notice, .tracker-bar { grid-column: 1 / -1; }
  .tracker-bar { margin: 0; padding-left: 0; padding-right: 0; }
  .tracker-side { margin-top: 14px; }
  .thread-all { max-width: 5.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tracker-meter-fill { transition: none; }
}

/* ==========================================================================
   Payments: Buy buttons (checkout.js) and downloads on the account page
   (account.js). Appended by the payments work; sitegen.py emits the hooks.
   ========================================================================== */
.buy-status {
  max-width: 44rem;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: var(--line);
  border-radius: 12px;
  background: var(--pink);
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.buy-status a { font-weight: 800; }
button.button[aria-busy="true"] { cursor: progress; }

.notice-success { background: var(--green); }

.account-download { margin: 10px 0 4px; }

/* Many products: compact cards, charts folded, a finder, grouped by kind. */
.account-product {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 0 12px; padding: 8px 12px 6px 14px;
}
.account-product .account-download {
  width: auto; min-height: 40px; margin: 0; padding: 0 16px; font-size: 0.95rem;
}
.account-product-head { min-width: 0; }
.account-group {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 -2px; font-family: var(--display); font-size: 1.25rem;
}
.account-group:first-child { margin-top: 0; }
.account-group-count {
  display: inline-block; min-width: 1.8em; padding: 0 8px;
  border: var(--line); border-radius: 999px; background: var(--card);
  font-family: var(--body); font-size: 0.8rem; font-weight: 700; line-height: 1.6; text-align: center;
}
.account-charts { grid-column: 1 / -1; margin-top: 2px; }
.account-charts > summary {
  display: inline-flex; align-items: center; min-height: 40px; font-size: 0.95rem;
  font-weight: 700; cursor: pointer; list-style-position: inside;
}
.account-charts .account-sublist {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0 16px; margin: 0; padding: 0 0 4px;
}
.account-charts .account-sublist a { min-height: 40px; }
.account-find { display: grid; gap: 6px; margin: 0 0 14px; }
.account-find label { font-weight: 700; }
.account-find input {
  min-height: 48px; padding: 0 14px; border: var(--line); border-radius: 12px;
  background: var(--card); font: inherit;
}
.account-find input:focus { outline: 3px solid var(--blue); outline-offset: 2px; }
.account-more { margin: 12px 0 0; }
.account-more .button { width: auto; }
.account-item-note { margin: 8px 0 0; color: var(--muted); font-size: 0.95rem; }

@media (min-width: 600px) {
  .account-download { width: auto; }
}

/* ---- card tints, generated from each pattern's threads ---- */
.tint-bauble-ornament { --tint: #ffefc7; }
.tint-gingerbread-man-ornament { --tint: #efddc8; }
.tint-stocking-ornament { --tint: #f0c6c6; }
.tint-christmas-tree-ornament { --tint: #ffefc7; }
.tint-snowman-ornament { --tint: #f0c6c6; }
.tint-candy-cane-ornament { --tint: #f0c6c6; }
.tint-mitten-ornament { --tint: #f0c6c6; }
.tint-penguin-in-a-hat-ornament { --tint: #f0c6c6; }
.tint-cocoa-mug-ornament { --tint: #f0c6c6; }
.tint-gift-box-ornament { --tint: #ffefc7; }
.tint-holly-sprig-ornament { --tint: #f0c6c6; }
.tint-snowy-house-ornament { --tint: #f0c6c6; }
.tint-snowy-poinsettia-cottage { --tint: #e7eaea; }
.tint-cat-at-the-christmas-window { --tint: #dec5c5; }
.tint-peeking-reindeer-fawn { --tint: #f1e1cc; }
.tint-goose-in-fairy-lights { --tint: #c4c6cc; }
.tint-snowman-in-a-snowflake-ring { --tint: #dbe5e9; }
.tint-holly-wreath-with-bow { --tint: #cfe7c3; }
.tint-sleepy-reindeer { --tint: #f1e1cc; }
.tint-robin-on-a-snowy-branch { --tint: #d8dee0; }
.tint-fox-in-a-flower-wreath { --tint: #fcdac8; }
.tint-little-fox-kit { --tint: #fcdac8; }
.tint-fox-looking-up { --tint: #fcdac8; }
.tint-fawn-in-wildflowers { --tint: #f1e1cc; }
.tint-robin-and-blue-tit { --tint: #fed3c5; }
.tint-celestial-bee { --tint: #eadabf; }
.tint-forest-witch { --tint: #c4c6cc; }
.tint-moth-and-crescent { --tint: #fcf1d5; }
.tint-hare-in-the-moon-window { --tint: #f1e1cc; }
.tint-owl-in-a-keyhole { --tint: #f3e6c7; }
.tint-fox-cameo { --tint: #f0d5bd; }
.tint-snail-crest { --tint: #f3e6c7; }
.tint-dragonfly-and-half-sun { --tint: #ffefc7; }
.tint-koi-roundel { --tint: #ffdfb7; }
.tint-toadstool-shrine { --tint: #f0c6c6; }
.tint-swallow-diamond { --tint: #f3e6c7; }
.tint-black-cat-medallion { --tint: #f3e6c7; }
.tint-gnome-hat-frog { --tint: #f0c6c6; }
.tint-wizard-frog { --tint: #cfe7c3; }
.tint-cat-under-the-blanket { --tint: #dde8dd; }
.tint-toad-in-a-teacup { --tint: #e0c1c4; }
.tint-raccoon-with-a-cookie { --tint: #cbd7d4; }
.tint-pigeon-with-bread { --tint: #f7ebcf; }
.tint-duck-in-rain-boots { --tint: #e0bdbf; }
.tint-capybara-in-a-hot-spring { --tint: #cfe0df; }
.tint-this-was-supposed-to-be-relaxing { --tint: #fef3cd; }
.tint-cat-in-a-cardboard-box { --tint: #f1e1cc; }
.tint-hedgehog-carrying-an-apple { --tint: #f8c3c8; }
.tint-goose-in-a-scarf { --tint: #f8c3c8; }
.tint-mole-with-a-lantern { --tint: #ffe8e8; }
.tint-snail-in-a-party-hat { --tint: #c1e8e7; }
.tint-capybara-with-an-orange { --tint: #ffdfb7; }
.tint-sheep-with-headphones { --tint: #f8c3c8; }
.tint-tulip-crocus-vine { --tint: #c4d1b7; }
.tint-cabbage-roses { --tint: #eecdd1; }
.tint-forget-me-not-bunch { --tint: #d4e0e7; }
.tint-navy-calla-lily-oval { --tint: #c5c8d1; }
.tint-folk-heart { --tint: #f9ced2; }
.tint-sunflower-roundel { --tint: #f2e1c0; }
.tint-lemon-branch { --tint: #fef9cd; }
.tint-marigold-trio { --tint: #fad5b9; }
.tint-daisy-check { --tint: #ffefc7; }
.tint-four-way-tulip { --tint: #ffe1dc; }
.tint-bramble-square { --tint: #e7d5db; }
.tint-folk-flower-windows { --tint: #e9d1bc; }
.tint-lavender-pair { --tint: #fee1e1; }
.tint-cyclamen-pot { --tint: #f3dbc6; }
.tint-wild-rose-corner { --tint: #f9ced2; }
.tint-crescent-and-star { --tint: #fcf1d5; }
.tint-cat-on-the-moon { --tint: #ffefc7; }
.tint-moon-over-the-sea { --tint: #c6cbd5; }
.tint-pumpkin-kitten { --tint: #ffdfb7; }
.tint-ghost-with-a-pie { --tint: #dfd3db; }
.tint-haunted-house-in-a-jar { --tint: #decad3; }
.tint-cat-at-the-night-window { --tint: #c4c6cc; }
.tint-moon-phases-strip { --tint: #c6cbd5; }
.tint-mushroom-cottage { --tint: #f0c6c6; }
.tint-owl-under-the-moon { --tint: #e4d4c4; }
.tint-moon-cat { --tint: #fff8e4; }
.tint-little-ghost { --tint: #decad3; }
.tint-lily-pad-frog { --tint: #c7e2e6; }
.tint-pumpkin-patch { --tint: #ffdfb7; }
.tint-tarot-the-moon-hare { --tint: #fefcf7; }
.tint-tarot-the-star-heron { --tint: #fefcf7; }
.tint-tarot-the-cat-moth { --tint: #fefcf7; }
.tint-heron-key-fret-frame { --tint: #c5c8d1; }
.tint-full-moon-greyscale { --tint: #f4f2ee; }
.tint-yin-yang-sleeping-cats { --tint: #fefcf7; }
.tint-stag-head-silhouette { --tint: #bdbbb7; }
.tint-running-hare-redwork { --tint: #f0c6c6; }
.tint-sleeping-fox-roundel { --tint: #e9d1bc; }
.tint-cat-on-the-sill { --tint: #c0c9cf; }
.tint-fern-pair-greenwork { --tint: #cdd1c3; }
.tint-hanging-lantern-blackwork { --tint: #f2e1c0; }
.tint-three-swallows-bluework { --tint: #c0c9cf; }
.tint-teapot-steam-hearts { --tint: #f0c6c6; }
.tint-oak-sprig-scalloped { --tint: #d7cabd; }
.tint-key-and-moth-blackwork { --tint: #bdbbb7; }
.tint-cottage-with-sheep { --tint: #e3e8cb; }
.tint-sunset-hills { --tint: #ffddd4; }
.tint-pine-river { --tint: #d4e1d4; }
.tint-mountain-waterfall { --tint: #dbe5e9; }
.tint-sea-sunset-rays { --tint: #f9d7d2; }
.tint-moon-lake-hoop { --tint: #c6cbd5; }
.tint-snow-fox-night { --tint: #f7d9c0; }
.tint-aurora-cabin { --tint: #c5c8d1; }
.tint-harbour-sunrise { --tint: #fce8ee; }
.tint-lavender-field { --tint: #fce8ee; }
.tint-hedgehog-by-candlelight { --tint: #f7d9c0; }
.tint-moonlit-whale-tail { --tint: #fff8e4; }
.tint-meadow-peek { --tint: #f1e1cc; }
.tint-desert-sunset { --tint: #fed3c5; }
.tint-cottage-at-first-snow { --tint: #f0c6c6; }
.tint-pocket-landscapes { --tint: #e9f6ef; }
.tint-highland-cow-thistle-bookmark { --tint: #f3dbc6; }
.tint-cat-on-books-bookmark { --tint: #f7ebcf; }
.tint-moon-and-stars-bookmark { --tint: #fcf1d5; }
.tint-sun-and-stars-bookmark { --tint: #fcf1d5; }
.tint-autumn-window-bookmark { --tint: #e4d4c4; }
.tint-winter-window-bookmark { --tint: #e4d4c4; }
.tint-orange-poppies-bookmark { --tint: #fec8b8; }
.tint-climbing-rose-bookmark { --tint: #f8c3c8; }
.tint-hedgehog-in-clover-bookmark { --tint: #dae1cf; }
.tint-lighthouse-night-bookmark { --tint: #fcf1d5; }
.tint-foxglove-and-bee-bookmark { --tint: #f9ced2; }
.tint-barn-owl-on-birch-bookmark { --tint: #dccdbf; }
.tint-sweet-pea-vine-bookmark { --tint: #f7ced5; }
.tint-pond-peek-frog-banner { --tint: #ddeac9; }
.tint-leaping-hares-banner { --tint: #f3e6c7; }
.tint-teacup-tower-bookmark { --tint: #fff0ee; }
.tint-sheep-and-heather-bookmark { --tint: #e7d5db; }
.tint-moon-ladder-bookmark { --tint: #f3e6c7; }
.tint-tiny-frog { --tint: #ddeac9; }
.tint-tiny-bee { --tint: #ffefc7; }
.tint-tiny-toadstool { --tint: #f0c6c6; }
.tint-tiny-strawberry { --tint: #f9ced2; }
.tint-tiny-ladybug { --tint: #f8c3c8; }
.tint-tiny-snail { --tint: #fce9d2; }
.tint-tiny-butterfly { --tint: #fce8ee; }
.tint-tiny-sunflower { --tint: #ffefc7; }
.tint-tiny-dragonfly { --tint: #d4efe6; }
.tint-tiny-duckling { --tint: #ffe6c2; }
.tint-tiny-watering-can { --tint: #d4efe6; }
.tint-tiny-tulip { --tint: #ffdbdd; }
