/* Pinned & Pending — muslin & clothespin theme */

:root {
  --muslin: #f3e7d7;
  --muslin-deep: #e9d8c1;
  --kraft: #d9c4a5;
  --ink: #3c3129;
  --ink-soft: #7a6a58;
  --rust: #b4552d;
  --sage: #4d6b5b;
  --mustard: #c8912a;
  --denim: #4a6a8f;
  --card: #fbf4e9;
  --twine: #b09a7c;
  --radius: 16px;
  --nav-h: 72px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--muslin);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-text-size-adjust: 100%;
}

#app { min-height: 100dvh; }

/* ---------- views ---------- */

.view {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 18px
           calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px) 18px;
}

.view-head { margin-bottom: 22px; }

.view-head h1 {
  margin: 0 0 4px;
  font-size: 1.7rem;
  font-weight: normal;
  letter-spacing: 0.02em;
}

.view-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-style: italic;
}

.section-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  font-weight: normal;
  margin: 0 0 10px;
}

/* ---------- twine ---------- */

.twine {
  position: relative;
  background: repeating-linear-gradient(
    -55deg,
    var(--twine) 0 5px,
    #c8b394 5px 10px
  );
  border-radius: 3px;
}

.twine-h { height: 5px; margin: 14px 6px 0; }

/* ---------- clothespin card ---------- */

.pin-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #e2d3bc;
  box-shadow: 0 3px 8px rgba(60, 49, 41, 0.10);
  padding: 16px 14px 12px 24px;
  margin: 0 0 18px;
  overflow: hidden;
}

/* left craft_type colour band */
.pin-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 9px;
  background: var(--band, var(--rust));
}

/* clothespin clipped over the twine at the top */
.clothespin {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 12px;
  height: 34px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #a8814f 0 40%, #c49a63 40% 60%, #8f6c3f 60%);
  border-radius: 5px;
  box-shadow: 0 2px 3px rgba(60, 49, 41, 0.35);
}

.clothespin::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #5d4426;
}

/* small circular stage pin */
.stage-pin {
  position: absolute;
  top: 16px;
  right: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--band, var(--rust));
  box-shadow: inset 0 0 0 2.5px var(--card), 0 1px 2px rgba(60,49,41,.3);
}

.pin-card--current {
  padding: 22px 16px 14px 27px;
  margin-top: 26px;
}

.pin-card--current .card-title { font-size: 1.35rem; }
.pin-card--current .clothespin { height: 42px; top: -18px; width: 14px; }

.pin-card--row { padding-bottom: 10px; }

.card-type {
  margin: 0 0 2px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.card-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: bold;
  line-height: 1.25;
}

.card-stage {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.card-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
  border-top: 1px dashed #d8c6ab;
  padding-top: 8px;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.card-date {
  font-size: 0.72rem;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

.card-actions { display: flex; gap: 8px; }

.mini-btn {
  font-family: inherit;
  font-size: 0.78rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--ink-soft);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.mini-btn.act-del {
  border-color: var(--rust);
  color: var(--rust);
}

.mini-btn:active { transform: scale(0.96); }

/* ---------- bench ---------- */

.bench-line {
  position: relative;
  padding-bottom: 6px;
}

.bench-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 2px 22px;
}

.counter-disc {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--muslin);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(60, 49, 41, 0.25);
}

.counter-num { font-size: 1.45rem; line-height: 1; }
.counter-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 2px;
}

.bench-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-style: italic;
}

/* rust quick-action strip */

.action-strip {
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  border-radius: 999px;
  background: var(--rust);
  color: var(--muslin);
  font-family: inherit;
  font-size: 1.05rem;
  padding: 15px 20px;
  cursor: pointer;
  box-shadow: 0 3px 7px rgba(180, 85, 45, 0.35);
  position: relative;
}

.action-strip:active { transform: translateY(1px); }

.strip-band {
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--muslin);
  opacity: 0.6;
  margin-right: 14px;
}

.strip-text { flex: 1; text-align: center; padding-right: 26px; }

.strip-pin {
  position: absolute;
  left: 18px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muslin);
  opacity: 0.9;
}

.bench-recent { margin-top: 28px; }

/* ---------- WIPs groups ---------- */

.type-group { margin-bottom: 26px; }

.group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 6px 6px;
  color: var(--ink);
}

.group-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--band);
}

.group-count {
  font-weight: normal;
  color: var(--ink-soft);
  letter-spacing: 0;
}

.twine-line {
  position: relative;
  padding: 16px 0 0 12px;
  border-left: 4px solid transparent;
  background:
    repeating-linear-gradient(-55deg, var(--twine) 0 4px, #c8b394 4px 8px)
    left top / 4px 100% no-repeat;
}

.twine-line .pin-card { margin-left: 8px; }

/* ---------- Capture (kraft panel) ---------- */

.kraft-panel {
  background: var(--kraft);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  box-shadow: 0 3px 8px rgba(60, 49, 41, 0.14);
}

.field { margin-bottom: 16px; }

.field label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  color: var(--ink);
}

.req {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--rust);
}

.opt {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.field input,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid #c3ab88;
  border-radius: 10px;
  padding: 12px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field textarea { resize: vertical; min-height: 76px; }

.field input:focus,
.field textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 2px rgba(77, 107, 91, 0.25);
}

/* keep forms usable while the mobile keyboard is open */
.field input { font-size: 16px; }

.form-error {
  margin: 0 0 12px;
  color: var(--rust);
  font-size: 0.88rem;
  font-weight: bold;
}

.form-actions {
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  font-family: inherit;
  font-size: 1rem;
  padding: 14px 10px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.btn-rust {
  background: var(--rust);
  color: var(--muslin);
  box-shadow: 0 2px 5px rgba(180, 85, 45, 0.35);
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink-soft);
}

.btn:active { transform: translateY(1px); }

/* ---------- Find ---------- */

.search-wrap { margin-bottom: 10px; }

#find-input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid #d3bf9f;
  background: var(--card);
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

#find-input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 2px rgba(77, 107, 91, 0.2);
}

.find-count {
  margin: 4px 4px 14px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- empty states: loose thread loop ---------- */

.thread-empty {
  text-align: center;
  padding: 34px 18px 26px;
  color: var(--ink-soft);
}

.loop {
  display: block;
  width: 74px;
  height: 44px;
  margin: 0 auto 14px;
  border: 4px solid var(--twine);
  border-color: var(--twine) transparent transparent var(--twine);
  border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
  transform: rotate(-8deg);
  opacity: 0.75;
}

.empty-text {
  margin: 0 0 6px;
  font-size: 1.02rem;
  color: var(--ink);
  font-style: italic;
}

.empty-help {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---------- bottom spool nav ---------- */

.spool-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-around;
  background: var(--muslin-deep);
  border-top: 1px solid #d8c3a4;
  padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
  z-index: 10;
}

.spool-tab {
  flex: 1;
  background: none;
  border: none;
  font-family: inherit;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0 2px;
  cursor: pointer;
  transform-origin: 50% 90%;
  transition: transform 0.15s ease;
}

.spool {
  position: relative;
  width: 22px;
  height: 22px;
  background: #c9b291;
  border-radius: 3px;
}

/* spool flanges */
.spool::before,
.spool::after {
  content: '';
  position: absolute;
  left: -4px;
  right: -4px;
  height: 5px;
  border-radius: 3px;
  background: #a88f6c;
}

.spool::before { top: -2px; }
.spool::after { bottom: -2px; }

.spool-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.spool-tab.active {
  color: var(--ink);
  transform: rotate(-7deg) translateY(-2px);
}

.spool-tab.active .spool {
  background: var(--rust);
  box-shadow: 0 4px 0 rgba(60, 49, 41, 0.22);
}

.spool-tab.active .spool::before,
.spool-tab.active .spool::after { background: #8f4a26; }

/* focus visibility for keyboard users */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}
