:root {
  --ink: #34232b;
  --muted: #9a8b91;
  --card: #ffffff;
  --line: #f2e3ea;
  --accent: #ff4d97;     /* candy raspberry */
  --accent2: #ff9a3d;    /* tangerine       */
  --accent-soft: #ffe1ee;
  --radius: 20px;
  --shadow: 0 2px 4px rgba(120,60,90,.05), 0 10px 26px rgba(160,70,120,.10);
  --shadow-pop: 0 6px 12px rgba(120,60,90,.08), 0 20px 44px rgba(160,70,120,.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 560px at 8% -12%, #ffe0ef 0%, transparent 60%),
    radial-gradient(1000px 520px at 112% -6%, #ffedd6 0%, transparent 55%),
    radial-gradient(900px 620px at 50% 120%, #e6f0ff 0%, transparent 60%),
    #fdf6f2;
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header / search ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,250,252,.82);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, #ff5da2, #ff9a3d, #6fd1ff) 1;
}
.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.site-brand {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.01em;
  white-space: nowrap;
  background: linear-gradient(90deg, #ff4d97 0%, #ff7a3d 55%, #ffb43d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.site-brand:hover { text-decoration: none; filter: saturate(1.15); }
.search { flex: 1 1 280px; position: relative; }
.search input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  font-size: 1rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23ff7aa8' stroke-width='2.4' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") 15px center no-repeat;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input::placeholder { color: #c9b6bf; }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---- Tag filter bar ---- */
.tagbar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  border: 1.5px solid var(--chip-bg, var(--line));
  background: var(--chip-bg, var(--card));
  color: var(--chip-ink, var(--muted));
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .12s ease, filter .12s ease;
  white-space: nowrap;
}
.chip:hover {
  text-decoration: none;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 12px rgba(160,70,120,.18);
  filter: saturate(1.1);
}
.chip:active { transform: scale(.96); }
.chip .count { opacity: .65; margin-left: 6px; font-variant-numeric: tabular-nums; font-weight: 700; }
.chip.active {
  background: var(--chip-strong, var(--accent));
  border-color: var(--chip-strong, var(--accent));
  color: #fff;
  box-shadow: 0 4px 14px var(--chip-glow, rgba(255,77,151,.4));
}
.chip.active .count { opacity: .85; }

/* Per-tag candy colours (pastel fill + readable dark ink + saturated active).
   Course tags */
.chip[data-tag="śniadanie"]          { --chip-bg:#fff1c2; --chip-ink:#8a6500; --chip-strong:#f6b900; --chip-glow:rgba(246,185,0,.4); }
.chip[data-tag="obiad"]              { --chip-bg:#ffe0c4; --chip-ink:#9a4f12; --chip-strong:#ff8a3d; --chip-glow:rgba(255,138,61,.42); }
.chip[data-tag="kolacja"]            { --chip-bg:#e8defb; --chip-ink:#6a3aa3; --chip-strong:#9a6bff; --chip-glow:rgba(154,107,255,.42); }
.chip[data-tag="deser"]              { --chip-bg:#ffd9ec; --chip-ink:#b13473; --chip-strong:#ff5da2; --chip-glow:rgba(255,93,162,.45); }
.chip[data-tag="przekąska"]          { --chip-bg:#d6f6e4; --chip-ink:#1d7a4c; --chip-strong:#2fc977; --chip-glow:rgba(47,201,119,.42); }
/* Dish-type tags */
.chip[data-tag="zupa"]               { --chip-bg:#d7ecff; --chip-ink:#1a6cb8; --chip-strong:#3d9bff; --chip-glow:rgba(61,155,255,.42); }
.chip[data-tag="ciasto"]             { --chip-bg:#ffdcdc; --chip-ink:#b23b3b; --chip-strong:#ff6b6b; --chip-glow:rgba(255,107,107,.42); }
.chip[data-tag="makaron"]            { --chip-bg:#ffeebc; --chip-ink:#946400; --chip-strong:#ffc234; --chip-glow:rgba(255,194,52,.42); }
.chip[data-tag="sałatka"]            { --chip-bg:#ddf3c2; --chip-ink:#4e7a1c; --chip-strong:#8fcf3f; --chip-glow:rgba(143,207,63,.42); }
.chip[data-tag="zapiekanka"]         { --chip-bg:#ffe2cd; --chip-ink:#a8541f; --chip-strong:#ff924d; --chip-glow:rgba(255,146,77,.42); }
.chip[data-tag="danie mięsne"]       { --chip-bg:#ffd7cf; --chip-ink:#b23a2a; --chip-strong:#ff6f57; --chip-glow:rgba(255,111,87,.42); }
.chip[data-tag="ryby i owoce morza"] { --chip-bg:#ccf0ee; --chip-ink:#0e8079; --chip-strong:#22c2b6; --chip-glow:rgba(34,194,182,.42); }

/* ---- Layout ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 22px 20px 8px; }
.result-meta {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  margin: 6px 2px 18px;
  min-height: 1.2em;
}

/* ---- Card grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), box-shadow .16s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, #ff5da2, #ff9a3d, #ffd23d, #6fd1ff);
  opacity: .85;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-pop); }
.card[hidden] { display: none; }
.card__title { font-size: 1.06rem; font-weight: 700; line-height: 1.35; margin: 2px 0 0; }
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--accent); text-decoration: none; }
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 1.1rem;
  font-weight: 600;
}

/* ---- Single recipe ---- */
.recipe {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 32px 36px;
  max-width: 760px;
  margin: 8px auto;
  overflow: hidden;
}
.recipe::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, #ff5da2, #ff9a3d, #ffd23d, #6fd1ff);
}
.recipe h1 { margin: 6px 0 6px; font-size: 1.95rem; line-height: 1.2; }
.recipe__meta { color: var(--muted); font-size: .85rem; margin-bottom: 16px; }
.recipe__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.recipe__body { font-size: 1.02rem; }
.recipe__body ul { padding-left: 1.3em; }
.recipe__body img { max-width: 100%; border-radius: 12px; }
.back-link { display: inline-block; margin-bottom: 16px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.back-link:hover { color: var(--accent); text-decoration: none; }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  padding: 44px 20px;
}

.page-title { font-size: 1.7rem; margin: 4px 0 10px; }

/* On mobile keep the tag bar to a single swipeable row instead of wrapping
   into several rows that would dominate the sticky header. */
@media (max-width: 640px) {
  .tagbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 12px 16px 12px;
    gap: 6px;
    scroll-snap-type: x proximity;
  }
  .tagbar::-webkit-scrollbar { display: none; }
  .tagbar .chip { flex: 0 0 auto; scroll-snap-align: start; }
}

@media (max-width: 560px) {
  .site-header__inner { gap: 12px; }
  .site-brand { font-size: 1.25rem; }
  .recipe { padding: 24px 18px 28px; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .chip, .card { transition: none; }
  .chip:hover, .card:hover { transform: none; }
}
