/* ============================================================
   PantryProof — Recipe Card Rack theme
   ============================================================ */

:root {
  --parchment: #f7eeda;
  --parchment-deep: #efe1c4;
  --card: #fffaf0;
  --ink: #3b2f26;
  --ink-soft: #7a6a58;
  --line: #e2d3b4;
  --tomato: #c7432f;
  --tomato-deep: #a93725;
  --basil: #6b7f4a;
  --saffron: #e4a11b;
  --cocoa: #7b4a2d;
  --cream: #fdf6e6;
  --tabbar-h: 66px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background:
    repeating-linear-gradient(0deg, rgba(122, 106, 88, 0.045) 0 1px, transparent 1px 28px),
    var(--parchment);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------- Top bar ---------- */

.topbar {
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px 6px;
}

.brand {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--tomato);
}

.brand-sub {
  margin: 2px 0 0;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------- Layout ---------- */

#main {
  padding: 8px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 26px);
  max-width: 560px;
  margin: 0 auto;
}

.view { animation: settle 180ms ease-out; }

@keyframes settle {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rack-heading {
  margin: 26px 0 12px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px dashed var(--line);
  padding-bottom: 6px;
}

.rack-heading-wide { margin-top: 18px; }

.count-chip {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  background: var(--tomato);
  color: var(--cream);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* ---------- Bench: stamped counters + quick add ---------- */

.bench-counters {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-top: 10px;
}

.stamped-counter {
  flex: 1;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 12px 10px 10px;
  text-align: center;
  box-shadow: 3px 3px 0 rgba(59, 47, 38, 0.14);
}

.counter-saffron { border-color: var(--saffron); }
.counter-saffron .stamped-num { color: var(--saffron); }

.stamped-num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--tomato);
  line-height: 1;
}

.stamped-label {
  display: block;
  margin-top: 6px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.quick-add {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 16px 12px;
  border: none;
  border-radius: 8px;
  background: var(--tomato);
  color: var(--cream);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--tomato-deep);
}

.quick-add:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--tomato-deep); }

/* ---------- Index-card slips ---------- */

.slip-stack { display: flex; flex-direction: column; }

.slip {
  position: relative;
  background:
    repeating-linear-gradient(0deg, transparent 0 25px, rgba(107, 127, 74, 0.14) 25px 26px),
    var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 22px 14px 12px;
  margin: 18px 0 0;
  box-shadow: 2px 3px 5px rgba(59, 47, 38, 0.12);
  cursor: pointer;
}

.slip:nth-child(odd)  { transform: rotate(-0.5deg); }
.slip:nth-child(even) { transform: rotate(0.45deg); }
.slip:nth-child(3n)   { margin-top: 24px; }
.slip:nth-child(4n)   { margin-top: 14px; }

.slip:active { box-shadow: 1px 2px 3px rgba(59, 47, 38, 0.16); }

/* torn masking-tape bar */

.tape {
  position: absolute;
  top: -9px;
  left: 50%;
  width: 96px;
  height: 18px;
  transform: translateX(-50%) rotate(-2deg);
  opacity: 0.88;
  clip-path: polygon(2% 0, 98% 5%, 100% 32%, 97% 100%, 4% 95%, 0 55%);
}

.tape-tomato  { background: var(--tomato); }
.tape-basil   { background: var(--basil); }
.tape-saffron { background: var(--saffron); }
.tape-cocoa   { background: var(--cocoa); }

.tape-form { width: 120px; }

.slip-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* trial-number disc */

.disc {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(253, 246, 230, 0.4);
}

.disc-tomato  { background: var(--tomato); }
.disc-basil   { background: var(--basil); }
.disc-saffron { background: var(--saffron); }
.disc-cocoa   { background: var(--cocoa); }

.slip-titles { min-width: 0; }

.slip h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
  color: var(--ink);
}

.slip .variation {
  margin: 3px 0 0;
  font-style: italic;
  font-size: 0.84rem;
  color: var(--basil);
  overflow-wrap: break-word;
}

.slip .note {
  margin: 10px 0 0;
  font-size: 0.92rem;
  color: var(--ink);
  overflow-wrap: break-word;
}

.slip-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.slip time {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.stamp-delete {
  border: 2px solid var(--tomato);
  background: transparent;
  color: var(--tomato);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 9px;
  border-radius: 3px;
  cursor: pointer;
  transform: rotate(-1.5deg);
}

.stamp-delete.armed {
  background: var(--tomato);
  color: var(--cream);
}

/* ---------- Empty states ---------- */

.empty-state {
  margin-top: 20px;
  padding: 26px 18px;
  border: 2px dashed var(--line);
  border-radius: 6px;
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  background: rgba(255, 250, 240, 0.55);
}

.empty-state strong {
  display: block;
  font-style: normal;
  color: var(--ink);
  margin-bottom: 4px;
}

/* ---------- Log form panel ---------- */

.form-panel {
  position: relative;
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px 16px 18px;
  box-shadow: 2px 3px 5px rgba(59, 47, 38, 0.12);
}

.form-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--tomato);
}

.form-hint {
  margin: 4px 0 14px;
  font-size: 0.84rem;
  font-style: italic;
  color: var(--ink-soft);
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

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

.field input:focus,
.field textarea:focus {
  border-color: var(--basil);
  background: #fff;
}

.field input.invalid,
.field textarea.invalid { border-color: var(--tomato); }

.err {
  display: none;
  margin: 5px 0 0;
  font-size: 0.78rem;
  color: var(--tomato);
}

.err.show { display: block; }

.field-search { margin-top: 14px; }

.field-search input { border-radius: 22px; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  flex: 1;
  padding: 13px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-primary {
  border: none;
  background: var(--basil);
  color: var(--cream);
  box-shadow: 0 3px 0 #55663a;
}

.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #55663a; }

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

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

.find-meta {
  margin: 10px 2px 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

/* ---------- Bottom tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 6px env(safe-area-inset-bottom, 0px);
  display: flex;
  background: var(--parchment-deep);
  border-top: 2px solid var(--ink);
  z-index: 10;
}

.tabbtn {
  flex: 1;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0 2px;
  cursor: pointer;
  color: var(--ink-soft);
  font-family: inherit;
}

.tablabel {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* flat CSS whisk glyph */

.whisk {
  position: relative;
  width: 26px;
  height: 26px;
  display: block;
  transition: transform 160ms ease, filter 160ms ease;
}

.w-loop {
  position: absolute;
  top: 0;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -4.5px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.w-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 3px;
  height: 5px;
  margin-left: -1.5px;
  background: currentColor;
  border-radius: 2px;
}

.w-balloon {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 20px;
  height: 13px;
  margin-left: -10px;
}

.w-balloon i {
  position: absolute;
  top: 0;
  left: 50%;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translateX(-50%);
}

.w-balloon i:nth-child(1) { width: 7px; }
.w-balloon i:nth-child(2) { width: 13px; }
.w-balloon i:nth-child(3) { width: 19px; }

/* active whisk tilts with a short shadow; inactive stays flat */

.tabbtn.active { color: var(--tomato); }

.tabbtn.active .whisk {
  transform: rotate(-14deg);
  filter: drop-shadow(2px 3px 0 rgba(59, 47, 38, 0.3));
}

.tabbtn:not(.active) .whisk { filter: none; transform: none; }
