/* ============================================================
   MEAL TRAIN — STYLE
   Mobile-first. Retro-cute: chunky borders, hard shadows,
   pixel fonts. Palette mirrors PALETTE in js/config.js.
   ============================================================ */

:root {
  --cream:  #FFF6E9;
  --ink:    #3A2E39;
  --peach:  #FFB385;
  --berry:  #E85D75;
  --sage:   #9BC995;
  --sky:    #A8D8EA;
  --butter: #FFD97D;
  --cocoa:  #8C6A5D;
  --blush:  #FFDAD1;
  --white:  #FFFFFF;

  --font-head: "Press Start 2P", monospace;
  --font-body: "VT323", monospace;

  --border: 3px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --radius: 2px;
}

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

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

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.35;
  min-height: 100dvh;
  /* soft pixel-grid texture */
  background-image:
    linear-gradient(rgba(58, 46, 57, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 46, 57, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

img, canvas { image-rendering: pixelated; }

/* ---------- app shell ---------- */

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 96px;
  min-height: 100dvh;
}

.screen { animation: screen-in 0.25s steps(6) both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- splash ---------- */

#splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--ink);
  display: flex;
}
#splash canvas { width: 100%; height: 100%; touch-action: manipulation; }
#splash.hidden { display: none; }

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

h1, h2, h3, .pixel {
  font-family: var(--font-head);
  line-height: 1.5;
  letter-spacing: 0;
}
h1 { font-size: 20px; margin-bottom: 8px; }
h2 { font-size: 15px; margin-bottom: 8px; }
h3 { font-size: 11px; margin-bottom: 6px; text-transform: uppercase; }

.sub { font-size: 22px; color: var(--cocoa); margin-bottom: 16px; }
.small { font-size: 18px; color: var(--cocoa); }
.center { text-align: center; }

/* ---------- cards & panels ---------- */

.card {
  background: var(--white);
  border: var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card.peach  { background: var(--blush); }
.card.sage   { background: #E4F2DF; }
.card.sky    { background: #E2F1F8; }
.card.butter { background: #FFF1CC; }

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.banner .sprite { flex-shrink: 0; }

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

.btn {
  display: block;
  width: 100%;
  font-family: var(--font-head);
  font-size: 12px;
  padding: 16px 12px;
  margin-bottom: 12px;
  background: var(--butter);
  color: var(--ink);
  border: var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  line-height: 1.4;
  transition: transform 0.05s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.berry { background: var(--berry); color: var(--white); }
.btn.sage  { background: var(--sage); }
.btn.sky   { background: var(--sky); }
.btn.ghost { background: var(--white); }
.btn.slim  { padding: 10px; font-size: 10px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.tiny {
  display: inline-block;
  width: auto;
  font-size: 8px;
  padding: 8px 10px;
  margin: 0 6px 0 0;
  box-shadow: 2px 2px 0 var(--ink);
}
.meal-item .actions { margin-top: 6px; }

.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }

/* ---------- forms ---------- */

label.field {
  display: block;
  margin-bottom: 14px;
}
label.field .lbl {
  font-family: var(--font-head);
  font-size: 10px;
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
}
input[type="text"], input[type="tel"], input[type="email"],
input[type="date"], select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 22px;
  padding: 10px 12px;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--butter);
}

.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  font-family: var(--font-body);
  font-size: 20px;
  padding: 8px 14px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
}
.chip.on { background: var(--sage); box-shadow: 2px 2px 0 var(--ink); }

.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0;
  font-size: 20px;
}
.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--berry); }

/* ---------- wizard progress ---------- */

.progress {
  display: flex;
  gap: 6px;
  margin: 4px 0 20px;
}
.progress .dot {
  flex: 1;
  height: 10px;
  border: 2px solid var(--ink);
  background: var(--white);
}
.progress .dot.done { background: var(--berry); }
.progress .dot.now  { background: var(--butter); }

/* ---------- calendar ---------- */

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-head button {
  font-family: var(--font-head);
  font-size: 14px;
  background: var(--white);
  border: var(--border);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 6px 12px;
  cursor: pointer;
}
.cal-head .month { font-family: var(--font-head); font-size: 12px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-grid .dow {
  font-family: var(--font-head);
  font-size: 8px;
  text-align: center;
  padding: 4px 0;
  color: var(--cocoa);
}
.cal-cell {
  aspect-ratio: 1;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: var(--radius);
  position: relative;
}
.cal-cell.pad { visibility: hidden; }
.cal-cell.open {
  border-color: var(--ink);
  background: var(--sage);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.cal-cell.open:active { transform: translate(2px, 2px); box-shadow: none; }
.cal-cell.taken {
  border-color: var(--ink);
  background: var(--blush);
}
.cal-cell.blocked {
  border-color: var(--ink);
  background: #E4DCD2;
  color: var(--cocoa);
}
.cal-cell.past { opacity: 0.35; }
.cal-cell.tappable { cursor: pointer; }
.cal-cell.tappable:active { transform: translate(2px, 2px); }
.cal-cell.selected { background: var(--butter); box-shadow: 2px 2px 0 var(--ink); }
.cal-cell .mark { font-size: 12px; line-height: 1; position: absolute; bottom: 3px; }

.legend { display: flex; gap: 16px; margin-top: 10px; font-size: 18px; }
.legend .key {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--ink); vertical-align: -2px; margin-right: 5px;
}

/* ---------- upcoming meals list ---------- */

.meal-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 2px dashed var(--cocoa);
}
.meal-item:last-child { border-bottom: none; }
.meal-item .date-badge {
  font-family: var(--font-head);
  font-size: 9px;
  text-align: center;
  background: var(--butter);
  border: 2px solid var(--ink);
  padding: 6px;
  min-width: 52px;
  line-height: 1.5;
}
.meal-item.open-slot .date-badge { background: var(--sage); }

/* ---------- confetti on confirm ---------- */

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

/* ---------- sticky footer nav ---------- */

#navbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: var(--border);
  display: none;
  z-index: 30;
}
#navbar.show { display: flex; }
#navbar a {
  flex: 1;
  text-align: center;
  padding: 10px 4px 14px;
  font-family: var(--font-head);
  font-size: 8px;
  color: var(--ink);
  text-decoration: none;
}
#navbar a .ico { font-size: 18px; display: block; margin-bottom: 4px; }
#navbar a.active { background: var(--butter); }

/* ---------- helpers ---------- */

.sprite { display: inline-block; }
.float { animation: float 2.4s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.wiggle { animation: wiggle 0.8s steps(2) infinite; }
@keyframes wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.divider {
  border: none;
  border-top: 3px dashed var(--cocoa);
  margin: 20px 0;
}

.note {
  font-size: 18px;
  color: var(--cocoa);
  background: var(--cream);
  border: 2px dashed var(--cocoa);
  padding: 10px 12px;
  margin: 12px 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-head);
  font-size: 10px;
  padding: 12px 18px;
  border: 3px solid var(--cream);
  box-shadow: var(--shadow);
  z-index: 60;
  animation: screen-in 0.2s steps(4) both;
}

@media (min-width: 700px) {
  body { font-size: 24px; }
  #app { padding-top: 32px; }
}
