/* KnutsBakBoek — warm, mobile-first bakboek */

:root {
  --cream: #fdf6ec;
  --cream-2: #f6ead8;
  --card: #fffdfa;
  --cocoa: #3a2317;
  --cocoa-soft: #7d6353;
  --caramel: #cf7f2c;
  --caramel-ink: #fff8ee;
  --raspberry: #c4485f;
  --line: rgba(58, 35, 23, .12);
  --shadow: 0 2px 10px rgba(58, 35, 23, .07), 0 12px 28px rgba(58, 35, 23, .06);
  --radius: 18px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cream: #17100c;
    --cream-2: #211710;
    --card: #241a13;
    --cocoa: #f4e7d8;
    --cocoa-soft: #b09a89;
    --caramel: #e3a45c;
    --caramel-ink: #241a13;
    --raspberry: #e0748a;
    --line: rgba(244, 231, 216, .14);
    --shadow: 0 2px 10px rgba(0, 0, 0, .35), 0 14px 30px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--cocoa);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
a { color: var(--caramel); }

[hidden] { display: none !important; }

/* --- app bar ------------------------------------------------------------ */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.appbar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.appbar__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.appbar__title em { font-style: normal; color: var(--caramel); }

.mark { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.mark--sm { width: 38px; height: 38px; border-radius: 11px; }
.mark--lg { width: 64px; height: 64px; border-radius: 18px; }

.iconbtn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  flex: none;
}

.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* --- views -------------------------------------------------------------- */

.view { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.pad { padding: 16px; }
.h2 { font-family: var(--font-display); font-size: 24px; margin: 6px 0 16px; }

/* --- zoeken ------------------------------------------------------------- */

.searchwrap {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 51px);
  z-index: 20;
  background: var(--cream);
  padding: 12px 14px 6px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 10px;
  box-shadow: var(--shadow);
}

.search:focus-within { border-color: var(--caramel); }

.search__icon { width: 19px; height: 19px; fill: none; stroke: var(--cocoa-soft); stroke-width: 2; stroke-linecap: round; flex: none; }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  padding: 12px 0;
  font-size: 16px; /* voorkomt inzoomen op iOS */
}

.search input::-webkit-search-cancel-button { display: none; }

.search__clear {
  border: 0;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: var(--cocoa-soft);
  cursor: pointer;
  padding: 0 4px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 10px 0 4px;
  margin: 0 -14px;
  padding-left: 14px;
  padding-right: 14px;
  scroll-snap-type: x proximity;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
}

.chip[aria-pressed="true"] {
  background: var(--cocoa);
  color: var(--cream);
  border-color: var(--cocoa);
}

.chip small { opacity: .55; margin-left: 5px; }

.resultline {
  margin: 4px 16px 0;
  font-size: 13px;
  color: var(--cocoa-soft);
  min-height: 18px;
}

/* --- receptenraster ----------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
  padding: 12px 14px;
}

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; padding: 16px 22px; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: transform .12s ease;
}

.card:active { transform: scale(.98); }

.card__img {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: var(--cream-2);
  display: block;
}

.card__body { padding: 10px 12px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }

.card__title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--cocoa-soft);
}

.card__meta span { display: inline-flex; align-items: center; gap: 3px; }
.card__meta svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.star { fill: var(--caramel); stroke: none; }

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--cream-2) 30%, color-mix(in srgb, var(--cream-2) 60%, var(--card)) 50%, var(--cream-2) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.2s linear infinite;
  aspect-ratio: .78;
}

@keyframes shimmer { to { background-position: -150% 0; } }

.loadmore {
  display: block;
  margin: 6px auto 0;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
}

.sentinel { height: 1px; }

.empty { text-align: center; padding: 48px 24px; color: var(--cocoa-soft); }
.empty__title { font-family: var(--font-display); font-size: 20px; color: var(--cocoa); margin: 0 0 6px; }
.linkbtn { border: 0; background: none; color: var(--caramel); text-decoration: underline; cursor: pointer; padding: 0; }

/* --- receptdetail ------------------------------------------------------- */

.hero { position: relative; background: var(--cream-2); }
.hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }

@media (min-width: 700px) { .hero img { aspect-ratio: 21 / 9; } }

.hero__actions {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.roundbtn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 253, 250, .92);
  color: #3a2317;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.roundbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.roundbtn.is-fav svg { fill: var(--raspberry); stroke: var(--raspberry); }
.hero__right { display: flex; gap: 8px; }

.recipe { padding: 18px 16px 0; max-width: 760px; margin: 0 auto; }

.recipe__title { font-family: var(--font-display); font-size: 27px; line-height: 1.15; margin: 0 0 8px; }
.recipe__desc { color: var(--cocoa-soft); margin: 0 0 14px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}

.pill svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.wake {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  margin: -6px 0 20px;
}

.wake svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.wake[aria-pressed="true"] {
  background: color-mix(in srgb, var(--caramel) 16%, var(--card));
  border-color: var(--caramel);
  color: var(--caramel);
}

.wake[aria-pressed="true"] svg { animation: glow 2.6s ease-in-out infinite; }

@keyframes glow { 50% { opacity: .45; } }

.section { margin-bottom: 26px; }

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section h2 { font-family: var(--font-display); font-size: 20px; margin: 0; }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 3px;
}

.stepper button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  color: var(--caramel);
}

.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { min-width: 68px; text-align: center; font-size: 13px; }

.ingredients { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.ingredients li + li { border-top: 1px solid var(--line); }

.ingredients label {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 14px;
  cursor: pointer;
}

.ingredients input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--caramel); flex: none; }
.ingredients input:checked + span { text-decoration: line-through; color: var(--cocoa-soft); }
.ingredients .amount { font-variant-numeric: tabular-nums; font-weight: 600; }

.group__name {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--caramel);
  margin: 18px 0 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 44px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--cocoa);
  color: var(--cream);
  font-size: 14px;
  font-weight: 600;
}

.steps li::after {
  content: "";
  position: absolute;
  left: 14.5px;
  top: 34px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}

.steps li:last-child::after { display: none; }

.notes {
  background: var(--cream-2);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14.5px;
}

.notes ul { margin: 0; padding-left: 18px; }
.notes li + li { margin-top: 6px; }

.source {
  display: block;
  text-align: center;
  padding: 18px 16px 8px;
  font-size: 13px;
  color: var(--cocoa-soft);
}

/* --- eigen notities en foto's -------------------------------------------- */

.notitie {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 13px 14px;
  font-size: 16px; /* voorkomt inzoomen op iOS */
  line-height: 1.5;
  resize: vertical;
  outline: none;
  font-family: inherit;
}

.notitie:focus { border-color: var(--caramel); }

.notitie__status { font-size: 12px; color: var(--cocoa-soft); white-space: nowrap; }

.mic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px;
  cursor: pointer;
}

.mic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.mic[aria-pressed="true"] {
  background: color-mix(in srgb, var(--raspberry) 16%, var(--card));
  border-color: var(--raspberry);
  color: var(--raspberry);
}

.mic[aria-pressed="true"] svg { animation: glow 1.4s ease-in-out infinite; }

.fotos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.fotos:empty { display: none; }

.fotos__item {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--cream-2);
}

.fotos__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotos__item.is-bezig { opacity: .4; }

.fotos__item--bezig {
  display: grid;
  place-items: center;
  color: var(--cocoa-soft);
  animation: shimmer 1.2s linear infinite;
  background: linear-gradient(100deg, var(--cream-2) 30%, var(--card) 50%, var(--cream-2) 70%);
  background-size: 300% 100%;
}

.fotos__wis {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(28, 18, 13, .6);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.verborgen-invoer { display: none; }

.source--klein { padding-top: 0; font-size: 12px; opacity: .8; }

.tagrow { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }

.tag {
  font-size: 12.5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  background: none;
  color: var(--cocoa-soft);
  cursor: pointer;
}

/* --- tabbar ------------------------------------------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}

.tab {
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 7px;
  font-size: 11px;
  color: var(--cocoa-soft);
  cursor: pointer;
}

.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--caramel); }
.tab[aria-current="page"] svg { fill: color-mix(in srgb, var(--caramel) 18%, transparent); }

/* --- knoppen ------------------------------------------------------------ */

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 13px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.btn--primary { background: var(--caramel); border-color: var(--caramel); color: var(--caramel-ink); }
.btn--ghost { background: none; color: var(--raspberry); }
.btn--block { width: 100%; }
.btn--sm { padding: 9px 14px; font-size: 14px; }
.btn:active { transform: scale(.985); }

/* --- panelen ------------------------------------------------------------ */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.panel__title { font-family: var(--font-display); font-size: 17px; margin: 0 0 6px; }
.panel__text { margin: 0 0 12px; color: var(--cocoa-soft); font-size: 14.5px; }
.colofon { font-size: 12.5px; color: var(--cocoa-soft); text-align: center; padding: 8px 6px 0; }

/* --- login -------------------------------------------------------------- */

.login {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 50% -10%, var(--cream-2), transparent 70%),
    var(--cream);
}

.login__card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px 24px 26px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login__title { font-family: var(--font-display); font-size: 26px; margin: 14px 0 4px; }
.login__title em { font-style: normal; color: var(--caramel); }
.login__sub { color: var(--cocoa-soft); font-size: 14.5px; margin: 0 0 22px; }

.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--cocoa-soft); margin-bottom: 5px; }

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 16px;
  background: var(--cream);
  outline: none;
}

.field input:focus { border-color: var(--caramel); }

.login__error {
  background: color-mix(in srgb, var(--raspberry) 12%, transparent);
  color: var(--raspberry);
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 14px;
  margin: 0 0 12px;
}

/* --- installbar & sheet ------------------------------------------------- */

.installbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 11px 13px;
  box-shadow: var(--shadow);
  animation: rise .3s ease;
}

@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

.installbar__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.installbar__text strong { font-size: 14.5px; }
.installbar__text span { font-size: 12.5px; color: var(--cocoa-soft); }

.installbar__close {
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--cocoa-soft);
  cursor: pointer;
  padding: 0 2px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(28, 18, 13, .45);
  display: grid;
  align-items: end;
}

.sheet__panel {
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(22px + var(--safe-b));
  animation: rise .28s ease;
}

@media (min-width: 700px) {
  .sheet { align-items: center; justify-items: center; }
  .sheet__panel { border-radius: 22px; max-width: 420px; width: 100%; }
}

.sheet h3 { font-family: var(--font-display); font-size: 20px; margin: 0 0 14px; }
.sheet__note { font-size: 13px; color: var(--cocoa-soft); }

.steps--plain { list-style: decimal; padding-left: 20px; }
.sheet .steps { counter-reset: step; padding-left: 0; }
.sheet .steps li { padding-left: 40px; padding-bottom: 14px; }

.inlineicon { width: 17px; height: 17px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
  transform: translateX(-50%);
  z-index: 70;
  background: var(--cocoa);
  color: var(--cream);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: rise .2s ease;
}

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