/* KandiPatternMaker — design system
   Bright beads: warm white, pony-bead colours as accents, rounded type,
   soft shadows instead of outlines. */

:root {
  --ink: #232946;
  --ink-2: #4a4f6e;
  --ink-3: #686c8a;
  --paper: #fffaf5;
  --paper-2: #fff3ea;
  --card: #ffffff;
  --mat: #f6e7da;          /* bead mat behind charts, same colour as the chart images */
  --pink: #d6336c;         /* buttons and active states */
  --pink-d: #c02a5f;       /* pink text and hover */
  --pink-soft: #ffe3ee;
  --bead-pink: #ff4f8b;    /* decorative beads only, too light for text */
  --teal: #0b7a7c;
  --yellow: #ffd23f;
  --lilac: #9b8cff;
  --sky: #3da5ff;
  --rule: #f0e2d4;
  --rule-2: #e6d3c2;
  --shadow-sm: 0 2px 10px rgba(35, 41, 70, 0.06);
  --shadow: 0 10px 30px rgba(35, 41, 70, 0.08);
  --shadow-pink: 0 20px 56px rgba(255, 79, 139, 0.14), 0 2px 8px rgba(35, 41, 70, 0.06);
  --radius: 20px;
  --font-display: "Fredoka", "Nunito", -apple-system, "Segoe UI", sans-serif;
  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1160px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img, svg, canvas { max-width: 100%; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 2px; text-decoration-color: rgba(214, 51, 108, 0.45); }
a:hover { color: var(--pink-d); text-decoration-color: currentColor; }

:focus-visible {
  outline: 3px solid var(--bead-pink);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 22px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
}
.skip:focus { left: 12px; top: 12px; color: #fff; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 250, 245, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand em { font-style: normal; color: var(--ink-3); font-weight: 500; }
.brand svg { flex: none; }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav a {
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 550;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--pink); color: #fff; }

.nav-toggle {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--card);
  border: 2px solid var(--rule-2);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
}

/* ---------- type ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
h3 { font-size: 1.2rem; letter-spacing: 0; }
h4 { font-size: 1rem; letter-spacing: 0; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pink-d);
  background: var(--card);
  border: 2px solid var(--pink-soft);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 16px;
}

.eyebrow-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow-line::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bead-pink);
  box-shadow: 14px 0 0 var(--yellow), 28px 0 0 var(--teal);
  margin-right: 28px;
  flex: none;
}
.section--ink .eyebrow-line { color: rgba(255, 255, 255, 0.6); }
.eyebrow-line + h2 { margin-top: 0; }

.lede {
  font-size: clamp(1.06rem, 1.7vw, 1.22rem);
  color: var(--ink-2);
  max-width: 62ch;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--rule-2);
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s, border-color 0.15s;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: #f2b3c9;
  color: var(--ink);
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn--primary { background: var(--pink); border-color: var(--pink); color: #fff; box-shadow: 0 4px 0 #a8244f; }
.btn--primary:hover { color: #fff; background: var(--pink-d); border-color: var(--pink-d); box-shadow: 0 5px 0 #a8244f; }
.btn--primary:active { box-shadow: 0 1px 0 #a8244f; }
.btn--ghost { background: transparent; box-shadow: none; border-color: var(--rule-2); }
.btn--ghost:hover { border-color: #f2b3c9; background: rgba(255, 255, 255, 0.6); }
.btn--small { font-size: 14px; padding: 8px 14px; }
.btn--block { width: 100%; }

/* ---------- hero ---------- */

.hero { padding: 40px 0 24px; }
.hero h1::after {
  content: "";
  display: block;
  width: 106px;
  height: 14px;
  margin-top: 12px;
  background:
    radial-gradient(circle at 7px 7px, var(--bead-pink) 6px, transparent 6.6px),
    radial-gradient(circle at 29px 7px, var(--yellow) 6px, transparent 6.6px),
    radial-gradient(circle at 51px 7px, var(--teal) 6px, transparent 6.6px),
    radial-gradient(circle at 73px 7px, var(--lilac) 6px, transparent 6.6px),
    radial-gradient(circle at 95px 7px, var(--sky) 6px, transparent 6.6px);
}
.lede { margin-bottom: 0; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-2);
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta svg { flex: none; color: var(--teal); }

/* ---------- tool ---------- */

.tool {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "upload canvas"
    "settings canvas";
  gap: 0;
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow-pink);
  overflow: hidden;
  margin-bottom: 34px;
}

.tool-controls { display: flex; flex-direction: column; gap: 14px; }
.tool-output { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.tool-upload,
.tool-settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
}
.tool-upload { grid-area: upload; padding: 20px 20px 10px; }
.tool-settings { grid-area: settings; padding: 10px 20px 20px; }
.tool-canvas {
  grid-area: canvas;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 20px;
}
.tool-export {
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 0 0;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  min-height: 174px;
  padding: 20px 16px;
  border: 2.5px dashed #f2b3c9;
  border-radius: 18px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.dropzone:hover { border-color: var(--bead-pink); background: #fffafc; }
.dropzone.is-drag {
  border-color: var(--pink);
  background: #fff0f5;
  transform: scale(1.01);
}
.dropzone strong { font-size: 16px; font-weight: 800; }
.dropzone .drop-thumb { display: none; width: 96px; height: 96px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.dropzone.has-file .drop-thumb { display: block; }
.dropzone.has-file .drop-icon { display: none; }
.dropzone span { font-size: 13px; color: var(--ink-3); }
.dropzone .drop-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--pink-soft);
  color: var(--pink-d);
}
.dropzone .file-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--pink-d);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-actions { display: flex; gap: 8px; }
.tool-actions .btn { flex: 1; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; }
.field > span { display: flex; justify-content: space-between; align-items: baseline; color: var(--ink-2); }
.field b { font-family: var(--font-mono); color: var(--ink); font-size: 14px; }
.field-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

select, input[type="number"], input[type="text"], textarea {
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--rule-2);
  border-radius: 12px;
  padding: 8px 10px;
  width: 100%;
  transition: border-color 0.15s;
}
select:hover, input:hover, textarea:hover { border-color: #d9bfae; }
select:focus, input:focus, textarea:focus { border-color: var(--pink); outline-offset: 1px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: var(--pink-soft);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--pink);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(214, 51, 108, 0.45);
}
input[type="range"]::-moz-range-track {
  height: 8px; border-radius: 999px; background: var(--pink-soft);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--pink);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(214, 51, 108, 0.45);
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 17px; height: 17px; margin: 0;
  accent-color: var(--pink);
  flex: none;
}

.hint {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-3);
  border-top: 1px dashed var(--rule-2);
  padding-top: 11px;
  margin: 0;
}

/* preview */

.preview-shell {
  position: relative;
  flex: 0 0 auto;
  height: clamp(340px, 60vh, 640px);
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border-radius: 18px;
  background-color: #fffdfb;
  background-image:
    linear-gradient(rgba(214, 51, 108, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 51, 108, 0.06) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: auto;
}
.preview-shell canvas {
  display: block;
  flex: none;
  margin: auto;
  max-width: none;
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(35, 41, 70, 0.12);
}
.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  border: 0;
  background: transparent;
  cursor: pointer;
}
.preview-empty > span { display: block; }
.preview-empty .bead-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.preview-empty .bead-row i {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--bead-pink);
}
.preview-empty .bead-row i:nth-child(2) { background: var(--yellow); }
.preview-empty .bead-row i:nth-child(3) { background: var(--teal); }
.preview-empty .bead-row i:nth-child(4) { background: var(--lilac); }
.preview-shell.has-pattern .preview-empty { display: none; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 4px 11px;
}
.stats b { font-family: var(--font-mono); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 132px;
  overflow: auto;
}
.legend .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 9px 3px 4px;
}
.legend .swatch {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid rgba(35, 41, 70, 0.35);
  flex: none;
}
.legend code { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

.export-row { display: flex; flex-wrap: wrap; gap: 9px; }
.export-row .btn { flex: 1 1 0; }

/* Full-panel collection: previews always preserve the chart's aspect ratio. */
.hero.hero--collection { padding: 52px 0 46px; text-align: left; overflow: hidden; }
.hero-collection-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 42px; align-items: center; }
.hero.hero--collection h1 { font-size: clamp(2.6rem, 4.5vw, 4.2rem); max-width: 540px; }
.hero.hero--collection .lede { font-family: var(--font-display); font-size: clamp(1.3rem, 2.2vw, 1.85rem); margin: 18px 0 14px; color: var(--ink); }
.hero-description { color: var(--ink-2); max-width: 460px; line-height: 1.75; }
.hero.hero--collection .hero-actions { justify-content: flex-start; }
.hero-collection { width: 100%; max-width: 450px; justify-self: end; padding: 22px 26px 16px; background: #eee5e3; border: 1px solid #dfd0cd; border-radius: 28px; box-shadow: 0 16px 40px #39213c0d; }
.hero-collection-label { display: flex; justify-content: space-between; font: 11px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; color: var(--ink-2); }
.hero-panel { display: block; text-decoration: none; margin: 4px 0 13px; transition: transform .18s ease; }
.hero-panel:hover { transform: translateY(-3px); }
.hero-panel img { display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 3px #24172b20); }
.hero-panel > span { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; padding: 0 12px; }
.hero-panel small { color: var(--ink-3); font: 10px var(--font-mono); }
.preview-note { font-size: 11px; color: var(--ink-3); text-align: center; margin: 8px 0 0; }
.pattern-grid.panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px; }
.pattern-card.pattern-card--panel .thumb { aspect-ratio: auto; min-height: 0; padding: 14px 10px; background: #ede5e7; }
.pattern-card.pattern-card--panel:nth-child(4n+2) .thumb { background: #dce7e3; }
.pattern-card.pattern-card--panel:nth-child(4n+3) .thumb { background: #eee8db; }
.pattern-card.pattern-card--panel:nth-child(4n+4) .thumb { background: #e4dfee; }
.pattern-card.pattern-card--panel .thumb img { width: 100%; height: auto; max-width: none; object-fit: contain; }
.pattern-card.pattern-card--panel .meta { padding: 20px 22px; }
.pattern-card.pattern-card--panel .meta h3 { font-size: 1.5rem; margin-top: 10px; }
.palette-strip { display: flex; gap: 4px; align-items: center; margin-top: 16px; }
.palette-strip span { width: 13px; height: 13px; border-radius: 50%; border: 1px solid #0002; }
.palette-strip small { font-size: 11px; color: var(--ink-3); margin-left: 5px; }
.collection-intro { padding-top: 44px; padding-bottom: 28px; }
.collection-intro > p { max-width: 670px; color: var(--ink-2); }
.collection-intro .panel-grid { margin-top: 28px; }
.pattern-detail.pattern-detail--panel { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; }
.pattern-detail.pattern-detail--panel .detail-chart { padding: 18px; background: #eee5e3; min-width: 0; max-width: none; }
.pattern-detail.pattern-detail--panel .detail-chart > img { width: 100%; height: auto; }
.chart-inspect { margin-top: 18px; font-size: 13px; width: 100%; min-width: 0; }
.chart-inspect summary { cursor: pointer; padding: 8px; text-align: center; }
.chart-scroll { max-width: 100%; overflow-x: auto; margin-top: 14px; }
.pattern-detail.pattern-detail--panel .chart-scroll img { width: 100%; min-width: 900px; max-width: none; height: auto; }
.pattern-detail.pattern-detail--panel .hint { font-size: 12px; color: var(--ink-3); line-height: 1.6; }
@media (max-width: 900px) {
  .hero-collection-grid { gap: 24px; grid-template-columns: 1fr 1fr; }
  .hero-collection { padding: 18px 12px 14px; }
  .pattern-detail.pattern-detail--panel { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero.hero--collection { padding-top: 30px; }
  .hero-collection-grid { grid-template-columns: 1fr; }
  .hero.hero--collection h1 { font-size: 2.6rem; }
  .hero-collection { max-width: 520px; width: 100%; }
  .pattern-grid.panel-grid { grid-template-columns: 1fr; gap: 22px; }
  .pattern-card.pattern-card--panel .meta { padding: 17px 20px; }
  .pattern-detail.pattern-detail--panel .detail-chart { padding: 10px; }
  .collection-intro { padding-top: 32px; }
}

/* ---------- generic sections ---------- */

.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
.section-head { max-width: 700px; margin-bottom: 30px; }
.section-head p { color: var(--ink-2); margin-bottom: 0; }

.band {
  background: var(--paper-2);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  counter-reset: step;
}
.step {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 12px;
}
.step:nth-child(4n+2)::before { background: var(--yellow); color: var(--ink); }
.step:nth-child(4n+3)::before { background: var(--teal); color: #fff; }
.step:nth-child(4n+4)::before { background: var(--lilac); color: var(--ink); }
.step h3 { margin-bottom: 6px; }
.step p { font-size: 14.5px; color: var(--ink-2); margin: 0; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.feature .ico {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--pink-soft);
  color: var(--pink-d);
  margin-bottom: 12px;
}
.feature h3 { font-size: 1.06rem; margin-bottom: 5px; }
.feature p { font-size: 14px; color: var(--ink-2); margin: 0; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 34px;
  align-items: center;
}

.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--bead-pink); }
.prose strong { font-weight: 650; }
.prose .callout {
  background: #fffbea;
  border-left: 6px solid var(--yellow);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 1.6em 0;
  font-size: 15.5px;
}

/* ---------- pattern gallery ---------- */

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(216px, 1fr));
  gap: 18px;
}
.pattern-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.14s, box-shadow 0.14s;
}
.pattern-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(214, 51, 108, 0.16); color: var(--ink); }
.pattern-card .thumb {
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--mat);
  min-height: 150px;
}
.pattern-card .thumb img { width: 100%; max-width: 192px; height: auto; }
.pattern-card .meta { padding: 13px 15px 16px; }
.pattern-card h3 { font-size: 1.02rem; margin: 0 0 2px; }
.pattern-card p { font-size: 12.5px; color: var(--ink-3); margin: 0; }
.pattern-card .tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 4px;
}

/* ---------- FAQ ---------- */

.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 18px;
  font-weight: 620;
  font-size: 15.5px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  color: var(--pink);
  flex: none;
}
.faq details[open] summary::after { content: "–"; }
.faq details[open] summary { border-bottom: 1px solid var(--rule); }
.faq .answer { padding: 14px 18px 18px; font-size: 15px; color: var(--ink-2); }

/* ---------- calculator ---------- */

.calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}
.calc-form { display: grid; gap: 14px; }
.calc-results { display: grid; gap: 12px; }
.result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper-2);
  border-radius: 14px;
  padding: 12px 16px;
}
.result .v { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.result .k { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.result--hero { background: var(--yellow); }

/* ---------- phrase tool ---------- */

.phrase-tool {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 24px;
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow-pink);
  padding: 22px;
}
.phrase-tool .tool-output { min-height: 300px; }
.phrase-tool .tool-controls { background: var(--paper-2); border-radius: 18px; padding: 20px; }
.phrase-tool .preview-shell { height: 360px; }
/* Complete design examples share the original warm, colourful UI. */
.design-example { margin: 0 0 28px; background: #eee5e3; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.design-example > a { display: block; padding: 16px; }
.design-example img { display: block; width: 100%; height: auto; }
.design-example figcaption { background: var(--card); padding: 20px 24px; font-size: 13px; }
.design-example figcaption strong { display: block; font: 600 20px var(--font-display); color: var(--ink); margin-bottom: 6px; }
.design-example figcaption span { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 12px; }
.design-example figcaption p { color: var(--ink-2); margin-bottom: 12px; }
#reading .design-example, .phrase-example .design-example { display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; }
#reading .design-example figcaption, .phrase-example figcaption { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 28px; }
.phrase-example { margin-top: 28px; }
@media (max-width: 820px) {
  #reading .design-example, .phrase-example .design-example { grid-template-columns: 1fr; }
  #reading .design-example figcaption, .phrase-example figcaption { padding: 20px; }
  .phrase-tool .tool-controls { padding: 16px; }
  .phrase-tool .preview-shell { height: 280px; }
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 30px;
  background: var(--paper-2);
  padding: 40px 0 26px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 26px;
}
.footer-grid h4 {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-grid a { font-size: 14px; text-decoration: none; color: var(--ink-2); }
.footer-grid a:hover { color: var(--pink-d); text-decoration: underline; }
.footer-about p { font-size: 13.5px; color: var(--ink-2); max-width: 34ch; }
.bead-strip { display: flex; gap: 7px; margin-top: 14px; }
.bead-strip i {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--bead-pink);
}
.bead-strip i:nth-child(2) { background: var(--yellow); }
.bead-strip i:nth-child(3) { background: var(--teal); }
.bead-strip i:nth-child(4) { background: var(--lilac); }
.bead-strip i:nth-child(5) { background: var(--sky); }
.footer-bottom {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-2);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-3);
}
.footer-bottom p { margin: 0; }

/* ---------- misc ---------- */

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; margin: 0; }
.pill-list a {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  background: var(--card);
  border: 2px solid var(--rule-2);
  border-radius: 999px;
  padding: 5px 13px;
  color: var(--ink-2);
}
.pill-list a:hover { border-color: #f2b3c9; background: #fff; color: var(--ink); }

.note {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 12px;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 14px; background: var(--card); }
table.beads { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 460px; }
table.beads th, table.beads td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--rule); }
table.beads th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); background: var(--paper-2); }
table.beads tr:last-child td { border-bottom: 0; }
table.beads td.num { font-family: var(--font-mono); text-align: right; }
.swatch-inline { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(35, 41, 70, 0.35); vertical-align: -2px; margin-right: 6px; }

.crumb { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { color: var(--pink-d); text-decoration: underline; }
.crumb span { margin: 0 6px; }

.cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(120deg, var(--pink), #6f5ce0);
  color: #fff;
  border-radius: 26px;
  padding: 28px 30px;
}
.cta-band h2 { color: #fff; margin: 0 0 4px; font-size: clamp(1.35rem, 2.6vw, 1.9rem); }
.cta-band p { color: rgba(255, 255, 255, 0.88); margin: 0; font-size: 14.5px; }
.cta-band .btn--primary { background: #fff; border-color: #fff; color: var(--pink-d); box-shadow: 0 4px 0 rgba(35, 41, 70, 0.18); }
.cta-band .btn--primary:hover { background: #fff; color: var(--pink-d); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
  .tool { grid-template-columns: 300px minmax(0, 1fr); }
  .phrase-tool { grid-template-columns: 320px minmax(0, 1fr); }
  .features { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  body { font-size: 16px; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow);
    padding: 12px 22px 18px;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 9px 12px; border-radius: 10px; font-size: 15.5px; line-height: 1.3; }
  .nav-toggle { display: inline-flex; }
  .header-inner { position: relative; }

  .tool, .phrase-tool { grid-template-columns: 1fr; padding: 0; }
  .phrase-tool { padding: 16px; }
  .tool {
    display: flex;
    flex-direction: column;
  }
  .tool-upload { order: 1; border-right: 0; border-bottom: 1px solid var(--rule); padding: 16px 16px 8px; }
  .tool-canvas { order: 3; padding: 16px 16px 6px; }
  .tool-export { padding: 16px 0 0; }
  .tool-settings { order: 2; border-right: 0; border-top: 1px solid var(--rule); padding: 16px; }
  .dropzone { min-height: 142px; padding: 14px; }
  .preview-shell { height: auto; min-height: 280px; }
  .tool .shortcuts { display: none; }
  .preview-shell { min-height: 220px; height: 340px; max-height: 50vh; }
  .hero { padding: 22px 0 16px; }
  .dropzone.has-file {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 2px 14px;
    align-items: center;
    justify-items: start;
    text-align: left;
    min-height: 0;
    padding: 12px 14px;
  }
  .dropzone.has-file .drop-thumb { grid-row: 1 / span 3; width: 64px; height: 64px; }
  .section { padding: 40px 0; }
  .steps { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 22px; }
  .calc { grid-template-columns: 1fr; }
  .cta-band { padding: 22px; }
}

@media (max-width: 520px) {
  .wrap { padding-inline: 16px; }
  .features { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .export-row .btn { flex: 1 1 calc(50% - 9px); padding-inline: 10px; }
  .tool-actions { flex-wrap: wrap; }
  .pattern-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .pattern-card .thumb { padding: 10px; min-height: 110px; }
  .pattern-card .meta { padding: 10px 11px 13px; }
  .pattern-card h3 { font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .site-footer, .export-row, .tool-controls { display: none !important; }
  body { background: #fff; }
  .tool { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- filters ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}
.filter-bar button {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--card);
  border: 2px solid var(--rule-2);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-bar button:hover { border-color: #f2b3c9; background: #fff; }
.filter-bar button[aria-pressed="true"] {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}

/* ---------- pattern detail ---------- */

.pattern-detail {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 34px;
  padding: 40px 0;
  border-bottom: 2px dashed var(--rule-2);
  align-items: start;
}
.pattern-detail:last-of-type { border-bottom: 0; }
.detail-chart {
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail-chart img { width: 100%; height: auto; }

.page-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.page-links li {
  background: var(--card);
  box-shadow: var(--shadow-sm);
  border-radius: 16px;
  padding: 14px 16px;
}
.page-links a { display: block; font-weight: 650; margin-bottom: 2px; }
.page-links span { font-size: 14px; color: var(--ink-2); }
.detail-body h2 { margin-bottom: 8px; }
.detail-body table.beads { min-width: 0; }
.detail-body .tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 6px;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.total-row td { border-top: 2px solid var(--rule-2); border-bottom: 0; }

.jump-link {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-2);
  background: var(--card);
  border: 2px solid var(--rule-2);
  border-radius: 999px;
  padding: 6px 14px;
}
.jump-link:hover { border-color: #f2b3c9; background: #fff; color: var(--ink); }

@media (max-width: 820px) {
  .pattern-detail { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 30px 0; }
  .detail-chart { max-width: 340px; }
}

/* empty preview: no phantom card behind the placeholder */
.preview-shell:not(.has-pattern) canvas { visibility: hidden; }
.btn--primary:disabled {
  background: var(--paper-2);
  color: var(--ink-3);
  border-color: var(--rule-2);
}

/* ---------- bead editor ---------- */

.panel {
  border: 2px solid var(--rule);
  border-radius: 12px;
  background: #fff;
}
.panel summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 620;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after {
  content: "+";
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
  color: var(--pink);
}
.panel[open] summary { border-bottom: 1px solid var(--rule); }
.panel[open] summary::after { content: "–"; }
.panel-body { padding: 12px; display: grid; gap: 11px; }

.swatch-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.stash-bead {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  background: var(--bead);
  border: 2px solid rgba(35, 41, 70, 0.3);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.stash-bead:hover { transform: scale(1.08); }
.stash-bead[aria-pressed="false"] { opacity: 0.24; }
.stash-bead[aria-pressed="false"]::after {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  height: 2px;
  background: var(--ink);
  transform: rotate(-45deg);
}

.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: var(--paper-2);
  border-radius: 16px;
}
.editor-bar[hidden] { display: none; }

.tool-group {
  display: inline-flex;
  background: #fff;
  border: 2px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
}
.tool-group button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.tool-group button:hover { color: var(--ink); }
.tool-group button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tool-group button:disabled { opacity: 0.32; cursor: default; }

.swatch-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 140px;
  min-width: 0;
  padding: 3px 2px;
}
.swatch-strip button {
  width: 20px;
  height: 20px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  background: var(--bead);
  border: 2px solid rgba(35, 41, 70, 0.3);
  cursor: pointer;
}
.swatch-strip button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink);
}

.preview-shell.has-pattern #preview { cursor: grab; touch-action: auto; }
.preview-shell.is-editing #preview { cursor: crosshair; touch-action: none; }

.check--small { font-size: 12.5px; font-weight: 500; }
.tool-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-2);
}

@media (max-width: 820px) {
  .editor-bar { gap: 6px; }
  .swatch-strip { flex-basis: 100%; order: 3; }
}

.shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: auto;
  padding-top: 10px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.shortcuts kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1;
  padding: 2px 5px;
  background: #fff;
  border: 1px solid var(--rule-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--ink-2);
}

/* ---------- crop stage ---------- */

.crop-stage {
  position: relative;
  height: 190px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--ink);
}
.crop-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.crop-stage canvas:active { cursor: grabbing; }
.crop-actions { display: flex; gap: 8px; }
.crop-actions .btn { flex: 1; }


/* ---------- bento features ---------- */

.feature--lead {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  align-items: center;
  background: var(--ink);
  border-color: var(--ink);
}
.feature--lead h3 {
  color: #fff;
  font-size: 1.42rem;
  margin-bottom: 7px;
}
.feature--lead p { color: rgba(255, 255, 255, 0.78); font-size: 14.5px; }
.feature--lead .ico {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  margin-bottom: 14px;
}
.feature-chart { display: grid; place-items: center; text-decoration: none; color: var(--card); }
.feature-chart img { width: 100%; height: auto; }
.feature-chart span { font-size: 12px; margin-top: 10px; color: var(--card); }

/* ---------- ink section ---------- */

.section--ink {
  background: var(--ink);
  color: #fff;
}
.section--ink h2 { color: #fff; }
.section--ink p { color: rgba(255, 255, 255, 0.8); }
.section--ink .note { color: rgba(255, 255, 255, 0.6); }
.section--ink a { color: var(--yellow); text-decoration-color: rgba(246, 196, 69, 0.45); }
.section--ink a:hover { color: #ffd873; }
.section--ink .table-wrap {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.24);
}
.section--ink table.beads th {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.66);
}
.section--ink table.beads td {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

@media (max-width: 980px) {
  .feature--lead { grid-column: span 2; grid-template-columns: 1fr 0.8fr; }
}
@media (max-width: 820px) {
  .feature--lead { grid-column: span 1; grid-template-columns: 1fr; }
  .feature-chart { order: -1; }
  .feature-chart img { max-width: 440px; }
}

/* empty preview doubles as a sample button */
.preview-empty {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  color: var(--ink-3);
}
.preview-empty:hover { color: var(--ink); }
.preview-empty .bead-row i { transition: transform 0.15s; }
.preview-empty:hover .bead-row i:nth-child(odd) { transform: translateY(-2px); }


.code-chips { display: flex; gap: 6px; margin: 14px 0 0; }
.code-chips span {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c);
  border: 1.5px solid rgba(35, 41, 70, 0.3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 520px) {
  .lede { font-size: 1rem; }
  .hero-meta { gap: 7px 14px; font-size: 12.5px; }
  .hero-meta span:nth-child(2),
  .hero-meta span:nth-child(4) { display: none; }
  .hero { padding: 18px 0 14px; }
}

.check-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 7px;
  vertical-align: -3px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
}

@media (min-width: 900px) {
  .faq {
    display: block;
    column-count: 2;
    column-gap: 12px;
    max-width: none;
  }
  .faq details {
    break-inside: avoid;
    margin-bottom: 10px;
  }
}

.settings-label {
  margin: 0 0 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* keep prose blocks left-aligned inside the page container */
.wrap.prose { max-width: var(--wrap); }
.wrap.prose > * { max-width: 760px; }

/* Workspace hierarchy shared with the chart and utility pages. */
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.hero-footnote { font-size: 13px; color: var(--ink-3); margin-top: 15px; }
.workspace-heading, .chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.workspace-heading { margin: 8px 0 18px; }
.workspace-heading h2 { font-size: 23px; margin: 4px 0 0; }
.workspace-heading > a { font-size: 13px; }
.stage-title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 17px; }
.stage-title > span { display: inline-grid; place-items: center; width: 27px; height: 27px; flex: none; border-radius: 50%; background: var(--pink-soft); color: var(--pink-d); font-size: 14px; }
.tool-settings .stage-title > span { background: #fff1bc; color: #755400; }
.chart-heading .stage-title > span { background: #daf2ed; color: var(--teal); }
.tool-export .stage-title > span { background: #ece7ff; color: #59479d; }
.tool { border: 1px solid var(--rule); align-items: stretch; }
.tool-settings { align-self: stretch; }
#conversionSettings { display: grid; gap: 15px; border: 0; padding: 0; margin: 0; min-width: 0; }
#conversionSettings:disabled { opacity: .6; }
.editor-bar { border: 1px solid var(--rule); gap: 7px; padding: 9px; }
.tool-group button { min-height: 40px; padding: 7px 11px; }
.brush-field { display: flex; gap: 8px; align-items: center; flex: 1 1 190px; font-size: 13px; }
.brush-field select { min-width: 0; flex: 1; width: 100%; min-height: 44px; background: #fff; border: 2px solid var(--rule-2); border-radius: 10px; font: inherit; padding: 7px; color: var(--ink); }
.canvas-help { font-size: 12px; line-height: 1.5; color: var(--ink-2); margin: -5px 0 0; }
.bead-list { border-top: 1px solid var(--rule); padding-top: 12px; }
.bead-list summary { font-weight: 800; font-size: 14px; cursor: pointer; padding: 7px 0; }
.bead-list .legend { max-height: none; padding: 12px 0; }
.bead-list .hint { border: 0; }
.preview-shell { overscroll-behavior: auto; }
.preview-shell canvas:focus-visible { outline-offset: -3px; }
.settings-disclosure { display: contents; }
.settings-disclosure > summary { display: none; }
.pattern-detail .detail-body > .stats { margin: 14px 0; }
.pattern-detail .detail-body > p:last-child { margin-top: 14px; }
@media (max-width: 1100px) and (min-width: 821px) {
  .header-inner { flex-wrap: wrap; padding-block: 10px; gap: 7px; }
  .nav { margin-left: 0; }
}
@media (max-width: 820px) {
  .workspace-heading { margin: 4px 0 12px; }
  .workspace-heading h2 { font-size: 19px; }
  .workspace-heading > a { display: none; }
  .settings-disclosure { display: block; }
  .settings-disclosure > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 15px; font-weight: 800; list-style: none; }
  .settings-disclosure > summary::after { content: "+"; color: var(--pink); }
  .settings-disclosure[open] > summary::after { content: "−"; }
  .settings-disclosure .tool-settings { margin-top: 14px; border-top: 0; padding: 0; }
  .tool > .settings-disclosure { order: 2; padding: 12px 16px; background: var(--paper-2); border-bottom: 1px solid var(--rule); }
  .tool-upload { padding: 12px 16px; }
  .tool-upload .stage-title { font-size: 15px; }
  .tool-upload .tool-actions { gap: 8px; }
  .tool-canvas { padding-top: 14px; }
  .editor-bar { position: sticky; top: 67px; z-index: 10; box-shadow: var(--shadow-sm); }
  .tool-group button { min-height: 42px; padding: 7px 10px; }
  .brush-field { flex-basis: 170px; }
  .history-group { margin-left: auto; }
  .hero h1::after { margin-top: 8px; }
  .hero .eyebrow { margin-bottom: 12px; }
  .hero-actions { margin-top: 16px; gap: 10px; }
  .hero-footnote { margin-top: 12px; }
  .brand { font-size: 16px; gap: 6px; }
  .brand svg { width: 25px; }
}
@media (max-width: 390px) {
  .brand em { display: none; }
  .hero-actions .btn { font-size: 14px; }
}

/* Keep the working chart in view as early as possible. */
.hero { padding-top: 26px; }
.hero .lede { max-width: 80ch; }
.hero h1 { margin-bottom: 16px; }
.workspace-heading { margin-top: 0; }
@media (max-width: 820px) {
  .hero { padding: 18px 0 12px; }
  .hero .eyebrow { font-size: 10px; padding: 3px 9px; margin-bottom: 10px; }
  .hero h1 { font-size: 30px; margin-bottom: 12px; }
  .hero .lede { font-size: 15px; line-height: 1.5; }
  .hero-actions { gap: 8px; margin-top: 12px; }
  .hero-actions .btn { padding: 10px 13px; font-size: 13px; }
  .hero-footnote { font-size: 11px; margin-top: 10px; }
  .workspace-heading .tag { display: none; }
  .workspace-heading h2 { font-size: 17px; margin-top: 0; }
  .tool-upload { gap: 9px; }
  .dropzone.has-file { padding: 9px 10px; gap: 1px 10px; grid-template-columns: 46px minmax(0,1fr); }
  .dropzone.has-file .drop-thumb { width: 46px; height: 46px; }
  .dropzone.has-file strong { font-size: 14px; }
  .dropzone.has-file span { font-size: 11px; }
  .dropzone.has-file .file-name { font-size: 10px; }
  .stage-title { font-size: 15px; }
  .chart-heading .jump-link { font-size: 12px; padding: 6px 10px; }
}

@media (max-width: 820px) {
  .workspace-heading { display: none; }
  .tool-upload > .stage-title { display: none; }
}
