/* Stooply — Porch-Step Queue theme. Flat, offline, mobile-first. */

:root {
  --porch-blue: #2f4f5f;
  --porch-blue-deep: #243d4a;
  --cream: #f2e8d5;
  --cream-soft: #faf5ea;
  --coral: #d97757;
  --teal: #3e8f84;
  --ochre: #c99a3a;
  --plum: #7a5a7e;
  --ink: #2b2b26;
  --muted: #6b6a63;
  --wood: #8a6a4b;
  --wood-dark: #6d5238;
  --radius: 14px;
  --gap: 12px;
  --margin: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }

body {
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  background: var(--porch-blue);
  color: var(--ink);
  min-height: 100vh;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- header: slim wooden house-number plate ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) var(--margin) 10px;
  background: var(--porch-blue-deep);
}

.house-plate {
  background: linear-gradient(180deg, var(--wood) 0%, var(--wood-dark) 100%);
  border-radius: 8px;
  border-bottom: 3px solid #57402c;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.plate-house {
  color: var(--cream);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}

.plate-sub {
  color: rgba(242, 232, 213, 0.75);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- main ---------- */

.view-root { flex: 1; padding: var(--gap) 0 calc(96px + env(safe-area-inset-bottom, 0px)); }

.view { padding: 0 var(--margin); display: flex; flex-direction: column; gap: var(--gap); }

.section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(242, 232, 213, 0.65);
  margin-top: 4px;
}

/* ---------- Board: flat enamel counters ---------- */

.counter-row { display: flex; gap: var(--gap); }

.enamel-counter {
  flex: 1;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.counter-open { background: #3d6478; color: var(--cream); }
.counter-helped { background: #4b6b52; color: var(--cream); }

.counter-num { font-size: 2rem; font-weight: 700; line-height: 1; }
.counter-label { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }

/* ---------- Board: wide chalk Add Ask strip ---------- */

.chalk-strip {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  background: #3a4f42;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(242, 232, 213, 0.15), 0 2px 0 rgba(0, 0, 0, 0.25);
}

.chalk-line {
  color: var(--cream-soft);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.chalk-sub {
  color: rgba(242, 232, 213, 0.7);
  font-size: 0.82rem;
}

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

/* ---------- porch-step cards ---------- */

.step-card {
  display: flex;
  gap: var(--gap);
  background: var(--cream-soft);
  border-radius: var(--radius);
  padding: 14px 14px 14px 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  position: relative;
}

.step-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.edge-teal::before { background: var(--teal); }
.edge-ochre::before { background: var(--ochre); }
.edge-coral::before { background: var(--coral); }
.edge-plum::before { background: var(--plum); }

.card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.card-meta { font-size: 0.82rem; color: var(--muted); }
.card-time { font-size: 0.72rem; color: rgba(107, 106, 99, 0.7); }

.card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.status-chip {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.chip-open { background: #e9eef0; color: var(--porch-blue); }
.chip-helped { background: #e4ead9; color: #44603f; }

.card-actions { display: flex; flex-direction: column; gap: 4px; }

.card-actions button, .pinned-actions button, .back-link {
  border: none;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  color: var(--porch-blue);
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 0;
}

.act-del { color: #a4503f !important; }
.act-toggle { font-weight: 600; }

/* ---------- pinned recent strip ---------- */

.pinned-strip { display: flex; flex-direction: column; gap: 8px; }
.pinned-actions { display: flex; justify-content: flex-end; }

/* ---------- empty states ---------- */

.empty-state {
  background: rgba(242, 232, 213, 0.12);
  border: 1px dashed rgba(242, 232, 213, 0.35);
  border-radius: var(--radius);
  padding: 26px var(--margin);
  text-align: center;
  color: var(--cream);
}

.empty-plate {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--cream-soft);
  color: var(--wood-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.empty-state h3 { font-size: 1rem; margin-bottom: 4px; }
.empty-state p { font-size: 0.85rem; color: rgba(242, 232, 213, 0.75); }

/* ---------- Add: paper slip form ---------- */

.paper-slip, .detail-slip, .search-slip {
  background: var(--cream-soft);
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.paper-slip { padding: var(--margin); }

.slip-note { font-size: 0.82rem; color: var(--muted); margin-bottom: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.field-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wood-dark);
}

.field input[type="text"], .field input[type="search"] {
  font: inherit;
  font-size: 1rem;
  padding: 12px;
  border: 1.5px solid #d9cfba;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  font-size: 16px; /* prevents iOS zoom */
}

.field input:focus { outline: none; border-color: var(--coral); }

.field.invalid input { border-color: #b04332; }
.field-error { color: #a4503f; font-size: 0.78rem; min-height: 0; }
.field-error:not(:empty) { margin-top: -2px; }

.type-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.type-choice, .status-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #f1ead9;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  border: 1.5px solid transparent;
}

.type-choice input, .status-choice input { accent-color: var(--porch-blue); }

.type-choice.chosen, .status-choice.chosen { border-color: var(--ink); background: #fff; }

.type-choice.edge-teal.chosen { border-color: var(--teal); }
.type-choice.edge-ochre.chosen { border-color: var(--ochre); }
.type-choice.edge-coral.chosen { border-color: var(--coral); }
.type-choice.edge-plum.chosen { border-color: var(--plum); }

.status-choices { display: flex; gap: 8px; }
.status-choice { flex: 1; justify-content: center; }

.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.btn-primary, .btn-ghost {
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
}

.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 2px 0 #b35c3f; }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost { background: transparent; color: var(--porch-blue); border: 1.5px solid var(--porch-blue); }

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

.back-link { align-self: flex-start; font-size: 0.85rem; color: var(--cream) !important; }

.detail-slip { padding: var(--margin); display: flex; flex-direction: column; gap: 12px; position: relative; padding-left: 22px; }

.detail-slip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.detail-title { font-size: 1.25rem; color: var(--ink); line-height: 1.3; }

.detail-rows { display: flex; flex-direction: column; gap: 10px; }

.detail-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed #d9cfba; padding-bottom: 8px; }
.detail-row dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.detail-row dd { font-size: 0.9rem; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions .btn-primary { flex: 1; }
.detail-actions .btn-ghost { font-size: 0.85rem; padding: 12px; }
.detail-actions .act-del {
  border: none; background: none; font: inherit; font-size: 0.85rem;
  font-weight: 700; color: #a4503f; cursor: pointer; padding: 12px;
}

/* ---------- Find: search-first ---------- */

.search-slip { padding: 8px; }

.search-slip input {
  font: inherit;
  font-size: 16px;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #d9cfba;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.search-slip input:focus { outline: none; border-color: var(--coral); }

.filter-row { display: flex; flex-direction: column; gap: 8px; }

.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }

.filter-chip {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(242, 232, 213, 0.4);
  background: transparent;
  color: rgba(242, 232, 213, 0.85);
  cursor: pointer;
}

.filter-chip.on { background: var(--cream); color: var(--porch-blue-deep); border-color: var(--cream); }

.about-note {
  margin-top: 8px;
  background: rgba(242, 232, 213, 0.12);
  border-radius: var(--radius);
  padding: var(--margin);
  color: rgba(242, 232, 213, 0.85);
}

.about-note h3 { font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.about-note p { font-size: 0.82rem; line-height: 1.5; }

/* ---------- bottom tab bar: four flat porch keys ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: var(--porch-blue-deep);
  padding: 8px var(--margin) calc(env(safe-area-inset-bottom, 0px) + 10px);
  gap: 8px;
  border-top: 1px solid rgba(242, 232, 213, 0.15);
}

.tabkey {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 6px 0 4px;
  font: inherit;
  transition: transform 0.15s ease;
}

/* flat key silhouette: round bow + slim shaft */
.key-head {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 4px 4px;
  background: rgba(242, 232, 213, 0.35);
  position: relative;
}

.key-head::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 100%;
  width: 8px;
  height: 10px;
  background: rgba(242, 232, 213, 0.35);
  border-radius: 0 0 3px 3px;
}

.key-label { font-size: 0.68rem; letter-spacing: 0.06em; color: rgba(242, 232, 213, 0.75); margin-top: 12px; }

/* active key tilts with a soft porch shadow */
.tabkey[aria-current="page"] { transform: rotate(-6deg) translateY(-2px); }

.tabkey[aria-current="page"] .key-head { background: var(--coral); }
.tabkey[aria-current="page"] .key-head::after { background: var(--coral); }

.tabkey[aria-current="page"] { filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.35)); }
.tabkey[aria-current="page"] .key-label { color: var(--cream); font-weight: 700; }

.tabkey:not([aria-current="page"]) { opacity: 0.85; }

/* ---------- narrow phones ---------- */

@media (max-width: 360px) {
  .type-choices { grid-template-columns: 1fr; }
  .card-actions button { font-size: 0.72rem; }
}
