@font-face {
  font-family: "Bricolage";
  src: url("fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #fff6e9;
  --paper: #fffdf8;
  --ink: #2a1e17;
  --muted: #7d6a5d;
  --line: #2a1e17;
  --soft-line: #ecdcc6;
  --tomato: #e8543c;
  --mustard: #f4b52f;
  --basil: #3f9a62;
  --sky: #4b97d1;
  --plum: #8a5bb5;
  --peach: #f59f7a;
  --mint: #6cc7b0;
  --shadow: 4px 4px 0 var(--line);
  --display: "Bricolage", ui-rounded, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1813;
    --paper: #2b221c;
    --ink: #fbefe1;
    --muted: #c4ae9c;
    --line: #0f0b08;
    --soft-line: #3d3128;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--mustard) 22%, transparent) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
a { color: inherit; }
main { max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; }
h1, h2, .dish, .brand, .tabs, .sticker, .page-title { font-family: var(--display); }
h2 { font-size: 1.25rem; margin: 0 0 10px; }

/* Colours, cycled per day and card */
.c0 { --c: var(--tomato); }
.c1 { --c: var(--mustard); }
.c2 { --c: var(--basil); }
.c3 { --c: var(--sky); }
.c4 { --c: var(--plum); }
.c5 { --c: var(--peach); }
.c6 { --c: var(--mint); }

/* Top bar */
.top {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 6px;
}
.brand { font-size: 1.6rem; font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { display: inline-block; transform: rotate(-12deg); }
.hello { font-weight: 600; color: var(--muted); }

/* Bottom tabs */
.tabs {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; z-index: 5;
  display: flex; justify-content: space-around;
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 6px;
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  text-decoration: none; font-weight: 700; font-size: 0.8rem; padding: 6px 4px; border-radius: 16px;
}
.tabs a span { font-size: 1.35rem; line-height: 1.1; }
.tabs a[aria-current="page"] { background: var(--mustard); color: #2a1e17; }

/* Week navigation */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 16px; }
.weeknav h1 { margin: 0; font-size: 2.6rem; font-weight: 800; line-height: 1; display: flex; align-items: baseline; gap: 8px; }
.weeknav h1 small { font-size: 1rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.weeknav a {
  text-decoration: none; font-size: 1.4rem; font-weight: 800; width: 46px; height: 46px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--paper); border: 2.5px solid var(--line); box-shadow: 3px 3px 0 var(--line);
}
.weeknav a:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }

/* Days */
.days { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.day {
  position: relative; display: grid; grid-template-columns: 70px 1fr;
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow);
}
.day .when {
  background: var(--c); color: #2a1e17; border-radius: 17px 0 0 17px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-right: 2.5px solid var(--line); padding: 10px 4px;
}
.dayname { font-family: var(--display); font-weight: 800; font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.02em; }
.date { font-size: 0.85rem; font-weight: 600; opacity: 0.8; }
.day .what { padding: 12px 14px; min-height: 76px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.dish {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-weight: 700; font-size: 1.2rem; line-height: 1.2;
}
.dish .emoji { font-size: 1.8rem; line-height: 1; }
.dish.plain { font-weight: 600; color: var(--muted); }
.dish.missing { color: var(--tomato); }
.meta { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.day .meta { padding-left: 2.6rem; }
.note { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.day.today { transform: rotate(-0.6deg); }
.day.today .what { background: color-mix(in srgb, var(--mustard) 18%, var(--paper)); border-radius: 0 17px 17px 0; }
.sticker {
  position: absolute; top: -12px; right: 14px; transform: rotate(4deg);
  background: var(--tomato); color: #fff; font-weight: 800; font-size: 0.85rem;
  padding: 3px 10px; border-radius: 999px; border: 2px solid var(--line);
}
.wished-by {
  align-self: flex-start; margin-top: 4px; margin-left: 2.6rem;
  font-size: 0.78rem; font-weight: 700; background: var(--mustard); color: #2a1e17;
  border: 2px solid var(--line); border-radius: 999px; padding: 1px 9px;
}
.cta {
  display: block; text-align: center; margin: 22px 0 0; padding: 14px; text-decoration: none;
  font-family: var(--display); font-weight: 800; font-size: 1.1rem;
  background: var(--basil); color: #fff; border: 2.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.cta:active, .wish-button:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--line); }

/* Page titles, search, tags */
.page-title { font-size: 2.2rem; font-weight: 800; line-height: 1.1; margin: 10px 0 14px; letter-spacing: -0.02em; }
.section-title { font-size: 1.3rem; margin: 26px 0 12px; }
.search input, .wish-free input {
  width: 100%; padding: 13px 16px; font-size: 1rem; border-radius: 16px;
  border: 2.5px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: 3px 3px 0 var(--line);
}
.search input:focus, .wish-free input:focus { outline: none; border-color: var(--tomato); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.tag, .chip {
  text-decoration: none; font-size: 0.88rem; font-weight: 700; padding: 4px 12px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--paper);
}
.tag.on { background: var(--tomato); color: #fff; }

/* Recipe grid */
.recipe-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recipe-grid a {
  height: 100%; display: flex; flex-direction: column; gap: 6px; text-decoration: none; padding: 14px;
  background: color-mix(in srgb, var(--c) 28%, var(--paper));
  border: 2.5px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.recipe-grid .emoji { font-size: 2.6rem; line-height: 1; }
.recipe-grid .dish { font-size: 1.05rem; }
.recipe-grid a:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--line); }

/* Recipe page */
.hero {
  text-align: center; padding: 22px 16px 18px; margin: 6px 0 16px;
  background: var(--mustard); color: #2a1e17; border: 2.5px solid var(--line); border-radius: 26px; box-shadow: var(--shadow);
}
.hero-emoji { font-size: 4.2rem; line-height: 1; display: inline-block; transform: rotate(-6deg); }
.hero h1 { font-size: 2rem; font-weight: 800; line-height: 1.1; margin: 8px 0 10px; letter-spacing: -0.02em; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; }
.hero .chip { background: #fff8ec; color: #2a1e17; }
.badge {
  display: inline-block; margin: 10px 0 0; font-size: 0.8rem; font-weight: 700;
  background: #fff8ec; border: 2px dashed #2a1e17; border-radius: 999px; padding: 2px 10px;
}
.wish-form { text-align: center; margin: 0 0 16px; }
.wish-button {
  display: inline-block; cursor: pointer; text-decoration: none;
  font: 800 1.1rem var(--display); padding: 12px 24px;
  background: var(--tomato); color: #fff; border: 2.5px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.wished-note { text-align: center; font-weight: 600; }
.wished-note a { color: var(--tomato); }
.card, .note-card {
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 16px 18px; margin: 0 0 16px;
}
.note-card { background: color-mix(in srgb, var(--mint) 25%, var(--paper)); }
.servings { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.servings h2 { margin: 0; }
.servings select {
  font: 700 0.95rem var(--display); padding: 6px 10px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink);
}
.ingredients { list-style: none; margin: 10px 0 0; padding: 0; }
.ingredients li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 2px dotted var(--soft-line); }
.ingredients li:last-child { border-bottom: none; }
.ingredients .amount { min-width: 76px; font-weight: 700; color: var(--tomato); font-variant-numeric: tabular-nums; }
.steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 12px 44px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px;
  display: grid; place-items: center; font: 800 0.95rem var(--display);
  background: var(--basil); color: #fff; border: 2px solid var(--line); border-radius: 50%;
}
.source { text-align: center; }
.source a { color: var(--tomato); font-weight: 700; }

/* Wishes */
.wish-free { display: flex; gap: 10px; align-items: center; }
.wish-free .wish-button { padding: 12px 18px; flex-shrink: 0; }
/* Recipe suggestions while typing (built by app.js under the field). */
.wish-free input::-webkit-calendar-picker-indicator { display: none !important; }
.suggest-wrap { position: relative; flex: 1; min-width: 0; }
.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20; list-style: none; margin: 0; padding: 6px;
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.suggestions[hidden] { display: none; }
.suggestions li {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
  font-weight: 700; cursor: pointer;
}
.suggestions li .emoji { font-size: 1.3rem; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--bg); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }
.hint a { color: var(--tomato); font-weight: 700; }
.wishes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wishes li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: color-mix(in srgb, var(--c, var(--mustard)) 22%, var(--paper));
  border: 2.5px solid var(--line); border-radius: 18px; box-shadow: 3px 3px 0 var(--line);
}
.wishes .emoji { font-size: 2rem; line-height: 1; }
.wish-body { flex: 1; display: flex; flex-direction: column; }
.wish-body .dish { font-size: 1.1rem; }
.who { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.remove {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-weight: 800;
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
}
.wishes.done li { background: var(--paper); box-shadow: none; border-style: dashed; opacity: 0.8; }

/* Shopping */
.aisle {
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  margin: 14px 0; overflow: hidden;
}
.aisle h2 {
  margin: 0; padding: 10px 16px; font-size: 1.05rem; display: flex; gap: 8px; align-items: center;
  background: color-mix(in srgb, var(--basil) 22%, var(--paper)); border-bottom: 2.5px solid var(--line);
}
.aisle ul { list-style: none; margin: 0; padding: 4px 16px; }
.aisle li { border-bottom: 2px dotted var(--soft-line); }
.aisle li:last-child { border-bottom: none; }
.aisle label { display: grid; grid-template-columns: 26px 1fr auto; column-gap: 10px; align-items: center; padding: 10px 0; cursor: pointer; }
.aisle input { width: 22px; height: 22px; accent-color: var(--basil); margin: 0; }
.aisle .item { font-weight: 600; }
.aisle .amount { font-weight: 700; color: var(--tomato); font-variant-numeric: tabular-nums; text-align: right; }
.aisle .used { grid-column: 2 / -1; font-size: 0.78rem; color: var(--muted); }
.aisle input:checked ~ .item, .aisle input:checked ~ .amount { text-decoration: line-through; opacity: 0.45; }
.pantry {
  margin-top: 18px; background: var(--paper); border: 2.5px dashed var(--line); border-radius: 20px; padding: 12px 16px;
}
.pantry summary { cursor: pointer; font: 800 1rem var(--display); }
.pantry ul { list-style: none; margin: 8px 0 0; padding: 0; }
.pantry li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 2px dotted var(--soft-line); color: var(--muted); }
.pantry li:last-child { border-bottom: none; }

/* Misc */
.empty-card {
  text-align: center; padding: 28px 16px; background: var(--paper);
  border: 2.5px dashed var(--line); border-radius: 20px; color: var(--muted); font-weight: 600;
}
.empty-card .big { font-size: 3rem; }
.empty-card p { margin: 6px 0 0; }
.flash {
  background: var(--mustard); color: #2a1e17; font-weight: 700; border: 2.5px solid var(--line);
  border-radius: 16px; padding: 10px 14px; box-shadow: 3px 3px 0 var(--line);
}
.warning {
  background: color-mix(in srgb, var(--tomato) 18%, var(--paper)); border: 2px solid var(--tomato);
  border-radius: 14px; padding: 10px 14px; margin: 10px 0; font-size: 0.95rem;
}
.warning ul { margin: 4px 0 0; padding-left: 1.2em; }
.foot { max-width: 640px; margin: 0 auto; padding: 8px 16px 20px; text-align: center; }
button.link { background: none; border: none; color: var(--muted); font: inherit; font-size: 0.85rem; cursor: pointer; text-decoration: underline; }

/* Login */
.login-page { padding-bottom: 0; }
.login { text-align: center; padding-top: 7vh; }
.login h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; margin: 10px 0; }
.emoji-cloud { font-size: 2.6rem; display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.emoji-cloud span:nth-child(odd) { transform: rotate(-10deg) translateY(4px); }
.emoji-cloud span:nth-child(even) { transform: rotate(8deg); }
.login .wish-button { margin-top: 18px; }
.dev { margin-top: 28px; }
.dev button {
  margin: 8px 4px 0; padding: 10px 18px; cursor: pointer; font: 700 1rem var(--display);
  background: var(--paper); color: var(--ink); border: 2.5px solid var(--line); border-radius: 999px; box-shadow: 3px 3px 0 var(--line);
}

@media (min-width: 560px) {
  .recipe-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Motion ---------- */
@keyframes pop-in {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: none; }
}
@keyframes wobble {
  0%, 100% { transform: rotate(4deg); }
  25% { transform: rotate(-6deg) scale(1.08); }
  50% { transform: rotate(8deg); }
  75% { transform: rotate(-2deg); }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg) scale(1.15); }
  75% { transform: rotate(10deg) scale(1.1); }
}
@keyframes float-up {
  0% { opacity: 1; transform: translate(0, 0) scale(0.6) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.3) rotate(var(--rot)); }
}
@keyframes bounce-in {
  0% { opacity: 0; transform: scale(0.7) rotate(-3deg); }
  60% { opacity: 1; transform: scale(1.05) rotate(1deg); }
  100% { transform: none; }
}
@keyframes check-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.days > li, .recipe-grid > li, .wishes > li, .aisle, .card, .hero {
  animation: pop-in 0.45s cubic-bezier(.2, .9, .3, 1.2) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes pop-in-tilted {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.02) rotate(-1deg); }
  100% { opacity: 1; transform: rotate(-0.6deg); }
}
.days > li.today { animation-name: pop-in-tilted; }
.sticker { animation: wobble 0.9s ease 0.5s both; }
.flash { animation: bounce-in 0.5s cubic-bezier(.2, .9, .3, 1.3) both; }

.recipe-grid a, .wishes li, .day, .tabs a, .tag, .chip, .weeknav a, .wish-button, .cta, .remove {
  transition: transform 0.15s cubic-bezier(.2, .9, .3, 1.4), box-shadow 0.15s ease, background-color 0.2s ease;
}
.recipe-grid a:hover, .day:hover { transform: translate(-1px, -2px) rotate(-0.4deg); box-shadow: 6px 6px 0 var(--line); }
.recipe-grid a:hover .emoji, .day:hover .dish .emoji, .recipe-grid a:active .emoji { animation: wiggle 0.5s ease; }
.hero-emoji { transition: transform 0.3s cubic-bezier(.2, .9, .3, 1.6); cursor: pointer; }
.hero-emoji:hover, .hero-emoji.spin { transform: rotate(354deg) scale(1.15); }
.tabs a:active { transform: scale(0.92); }
.tabs a[aria-current="page"] span { display: inline-block; animation: wiggle 0.6s ease 0.1s; }
.tag:hover, .chip:hover { transform: rotate(-2deg) scale(1.05); }
.wish-button:hover, .cta:hover { transform: translate(-1px, -2px); box-shadow: 6px 6px 0 var(--line); }
.remove:hover { transform: rotate(90deg); background: var(--tomato); color: #fff; }

.aisle input:checked { animation: check-pop 0.3s ease; }
.aisle .item, .aisle .amount { transition: opacity 0.25s ease; }
.aisle.done h2 { background: color-mix(in srgb, var(--basil) 55%, var(--paper)); }
.aisle.done h2::after { content: "✓"; margin-left: auto; font-weight: 800; animation: bounce-in 0.4s both; }
.all-done {
  text-align: center; font: 800 1.3rem var(--display); margin: 18px 0 0; padding: 14px;
  background: var(--basil); color: #fff; border: 2.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  animation: bounce-in 0.5s cubic-bezier(.2, .9, .3, 1.3) both;
}

.burst { position: fixed; pointer-events: none; z-index: 50; font-size: 1.6rem; left: 0; top: 0; }
.burst span { position: absolute; animation: float-up 0.9s ease-out forwards; }
.wish-button.sending { animation: wiggle 0.4s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Who eats at home: small letters on the same line as the time.
   Colour is the answer: green home, struck grey away, dashed unknown. */
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.who { display: flex; gap: 4px; flex-shrink: 0; }
.who form { margin: 0; }
.person {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; padding: 0;
  font: inherit; font-weight: 800; font-size: 0.78rem; line-height: 1;
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
}
button.person { cursor: pointer; }
button.person:active { transform: scale(0.92); }
.person .mark { display: none; }
.person.okant { border-style: dashed; border-color: var(--muted); color: var(--muted); }
.person.hemma { background: var(--basil); border-color: var(--basil); color: #fff; }
.person.borta { background: var(--soft-line); border-color: var(--soft-line); color: var(--muted); text-decoration: line-through; }
.person.me { box-shadow: 0 0 0 2px var(--mustard); }
.tonight { margin: 6px 0 0; font-size: 0.82rem; font-weight: 700; color: var(--ink); text-align: right; } /* under the letters */
