/* Sampler — Embroidery-Hoop Bench theme */

:root {
  --linen: #f7f1e4;
  --linen-deep: #efe6d3;
  --card: #fffdf6;
  --ink: #3c352b;
  --muted: #8a7f6c;
  --line: #e3d8c2;
  --sage: #6b8f71;
  --sage-soft: #e2ecdf;
  --clay: #c97b63;
  --indigo: #2f4b5e;
  --mustard: #b98a2f;
  --danger: #a04b3a;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--linen);
  background-image: repeating-linear-gradient(
    45deg, transparent 0 14px, rgba(107, 143, 113, 0.05) 14px 15px);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}

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

.shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(96px + env(safe-area-inset-bottom, 0px));
}

/* ---------- top line ---------- */
.topline {
  display: flex; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 0 14px;
}
.brand-ring {
  width: 30px; height: 30px; flex: 0 0 30px;
  border: 3px solid var(--clay);
  border-radius: 50%;
  position: relative;
}
.brand-ring::after {
  content: ""; position: absolute;
  top: 50%; left: -6px; right: -6px; height: 2px;
  background: var(--indigo); transform: rotate(-35deg);
}
.topline h1 { font-size: 20px; letter-spacing: 0.04em; }
.tagline { color: var(--muted); font-size: 13px; margin-left: auto; }

/* ---------- tabs ---------- */
.tab { display: none; padding-top: 6px; }
.tab.active { display: block; }
.section-title {
  font-size: 15px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--indigo); margin: 8px 0 12px;
}

/* ---------- shared cards & dots ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(60, 53, 43, 0.06);
}
.dot {
  display: inline-block; width: 11px; height: 11px;
  border-radius: 50%; vertical-align: -1px; margin-right: 6px;
  border: 2px solid var(--sage);
}
.dot.open { background: var(--sage); }
.dot.done { background: transparent; border-color: var(--muted); }
.bead {
  display: inline-block; width: 12px; height: 12px; flex: 0 0 12px;
  border-radius: 50%; border: 2px solid var(--clay);
}
.bead.full { background: var(--clay); }
.bead.empty { border-color: var(--line); background: transparent; }

/* ---------- bench ---------- */
.bead-row { display: flex; gap: 10px; margin-bottom: 12px; }
.bead-count {
  flex: 1; padding: 12px 14px; display: flex; align-items: center; gap: 10px;
}
.bead-count .num { font-size: 26px; font-weight: 700; line-height: 1; }
.bead-count .lbl { font-size: 12px; color: var(--muted); line-height: 1.2; }

.add-strip {
  width: 100%; display: block;
  background: var(--sage); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 16px; font-size: 17px; font-weight: 600;
  letter-spacing: 0.03em; cursor: pointer;
  margin-bottom: 16px;
}
.add-strip:active { background: #5a7d61; }

.hoop-card { padding: 18px; display: flex; gap: 16px; align-items: flex-start; }
.hoop-ring {
  width: 72px; height: 72px; flex: 0 0 72px;
  border: 4px solid var(--clay);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: var(--indigo);
  background: var(--linen-deep);
  position: relative;
}
.hoop-ring::after {
  content: ""; position: absolute; top: 46%; left: -9px; width: 26px; height: 2px;
  background: var(--indigo); transform: rotate(-40deg);
}
.hoop-card .body { flex: 1; min-width: 0; }
.hoop-card h3 {
  font-size: 19px; line-height: 1.25; overflow-wrap: break-word;
}
.hoop-card .type-line {
  display: inline-block; margin-top: 6px;
  background: var(--sage-soft); color: var(--indigo);
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
}
.hoop-card .step {
  margin-top: 10px; font-size: 14px; color: var(--muted);
  overflow-wrap: break-word;
}
.hoop-card .step strong { color: var(--ink); font-weight: 600; }
.hoop-card .actions { margin-top: 14px; display: flex; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: 15px; font-weight: 600;
  border-radius: 10px; padding: 12px 18px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink); cursor: pointer; min-height: 46px;
}
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn.primary:active { background: #243b4a; }
.btn.quiet { background: var(--linen-deep); }
.btn.danger {
  width: 100%; margin-top: 10px;
  background: transparent; border-color: var(--danger); color: var(--danger);
}
.btn.small { padding: 8px 12px; min-height: 38px; font-size: 13px; }
.btn:active { filter: brightness(0.94); }

/* ---------- crafts list ---------- */
.group { margin-bottom: 16px; }
.group h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); margin: 0 2px 6px;
}
.row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--line); border-left: 5px solid var(--sage);
  border-radius: 10px; padding: 4px;
  margin-bottom: 8px;
}
.row-main {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: none; font: inherit; color: inherit;
  padding: 10px 4px 10px 10px; cursor: pointer;
}
.row-main .t { font-weight: 600; font-size: 15px; overflow-wrap: break-word; }
.row-main .m { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .toggle {
  font: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--linen-deep); color: var(--ink);
  padding: 9px 12px; min-height: 40px; cursor: pointer;
  white-space: nowrap;
}
.row .toggle.finished { background: var(--sage-soft); border-color: var(--sage); color: var(--indigo); }
.row:active { background: #fbf6ea; }

/* ---------- new / edit form ---------- */
.swatch-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: 0 1px 2px rgba(60, 53, 43, 0.06);
}
.field { margin-bottom: 16px; border: none; }
.field label, .field legend {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--indigo); margin-bottom: 6px;
}
.req { color: var(--clay); font-weight: 600; font-size: 11px; margin-left: 4px; }
.opt { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 4px; }
.field input[type="text"], .field input[type="search"] {
  width: 100%; font: inherit; font-size: 16px;
  padding: 12px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--linen); color: var(--ink);
}
.field input:focus { outline: 2px solid var(--sage); outline-offset: 1px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 5px; }
.status-pills { display: flex; gap: 10px; }
.status-pills input { position: absolute; opacity: 0; }
.status-pills .pill span {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--linen-deep);
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.status-pills input:checked + span {
  background: var(--sage-soft); border-color: var(--sage); color: var(--indigo);
}
.status-pills input:focus-visible + span { outline: 2px solid var(--indigo); }
.form-actions { display: flex; gap: 10px; }
.form-actions .btn { flex: 1; }

/* ---------- find ---------- */
.find-box { margin-bottom: 12px; }
.find-box input {
  width: 100%; font: inherit; font-size: 16px;
  padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--card); color: var(--ink);
}
.find-box input:focus { outline: 2px solid var(--sage); outline-offset: 1px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  font: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink);
  padding: 8px 14px; min-height: 38px; cursor: pointer;
}
.chip.on { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.find-meta { font-size: 12px; color: var(--muted); margin: 0 2px 8px; }

/* ---------- empty states ---------- */
.empty {
  text-align: center; padding: 34px 20px;
  color: var(--muted); font-size: 14px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: rgba(255, 253, 246, 0.6);
}
.empty .ring {
  width: 46px; height: 46px; margin: 0 auto 10px;
  border: 3px solid var(--line); border-radius: 50%;
}

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center; gap: 4px;
  background: #f2ead9;
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
}
.tabbar::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px;
  background: rgba(255, 255, 255, 0.7);
}
.spool {
  flex: 1; max-width: 120px;
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px 2px; position: relative;
  color: var(--muted); font: inherit; font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
}
.spool svg { width: 26px; height: 26px; fill: currentColor; }
.spool.active { color: var(--indigo); }
.spool.active::before {
  content: ""; position: absolute; top: -4px; left: 50%;
  width: 2px; height: 12px; border-radius: 2px;
  background: var(--clay);
}
.spool:active { color: var(--indigo); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  background: var(--indigo); color: #fff;
  font-size: 14px; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(47, 75, 94, 0.3);
  z-index: 20; max-width: 88vw; text-align: center;
}
