/* --- List: recipe grid must be multi-column --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-4);
  align-items: start;
}

/* Kompakt: immer 3 Spalten */
.grid.is-compact {
  grid-template-columns: repeat(3, 1fr);
}

/* Kompakt: immer 3 Spalten */

.grid-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: var(--r-2);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.grid-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
}

.grid-body{
  padding: .55rem .65rem .7rem;
  border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
}

.grid-title > span{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-weight: 700;
}

.grid-meta{
  margin-top: .4rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

/* --- Detail: image must be embedded/clipped --- */
.img-focus-frame {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--r-2);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.img-focus-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  max-width: 100%;
  max-height: 100%;
}
#imgPreviewWrap img {
  background: transparent !important;
}

/* --- FAB fixed overlay + menu --- */
.fab {
  position: fixed;
  right: var(--s-5);
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  z-index: var(--z-fab);
}
/* ---------- Floating Action Button (Add) ---------- */
.fab-add {
  position: fixed;
  right: var(--s-5);
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  z-index: var(--z-fab);
  width: 48px;          /* vorher meist ~32px */
  height: 48px;
  border-radius: 50%;   /* rund */
background-color:  var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color:  var(--text);
  font-size: 28px;      /* Icon/Text größer */
  line-height: 1;
  border-color: var(--primary);
  
}

/* Hover / Active */
.fab-add:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 28px rgba(0,0,0,.4),
    0 3px 8px rgba(0,0,0,.3);
}

.fab-add:active {
  transform: translateY(0);
  border-bottom: var(--primary);
}
.fab-add::after {
  content: "";
  position: absolute;
  inset: -8px;
}


.fab-menu {
  position: fixed;
  right: var(--s-5);
  bottom: calc(var(--s-5) + 56px + env(safe-area-inset-bottom));
  z-index: var(--z-fabmenu);
  min-width: 180px;
}

.fab-menu[hidden] {
  display: none !important;
}

.fab-menu__item {
  width: 100%;
  justify-content: flex-start;
}

/* subtle open animation (respects reduced motion) */
.fab-menu {
  opacity: 0;
  transform: translateY(var(--s-1_5));
  transition: opacity 120ms ease, transform 120ms ease;
}

.fab-menu.is-open {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fab-menu {
    transition: none;
    transform: none;
  }
}
/* Winter overlay (optional) */
body.winter::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 50% -150px, rgba(255,255,255,.55), rgba(255,255,255,0) 70%),
    linear-gradient(to bottom, rgba(220,240,255,.18), rgba(0,0,0,0));
  mix-blend-mode: screen;
  z-index: var(--z-floating);
}

/* Step highlighting */
.step-current{
  outline: 2px solid rgba(210,179,123,0.45);
  outline-offset: 3px;
  border-radius: var(--r-1);
}
body.dark .step-current{ outline-color: rgba(210,179,123,0.55); }

/* Recipe cover fallback */
.recipe-cover{
  width: 64px;
  height: 64px;
  border-radius: var(--r-1_5);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 1.35rem;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(210,179,123,.22), rgba(210,179,123,.06));
  border: 1px solid var(--border);
}
body.dark .recipe-cover{ background: linear-gradient(135deg, rgba(210,179,123,.22), rgba(210,179,123,.07)); }

.list-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--cat-accent, #dfe);
  opacity: 0.55;
}

.li-left {
  display: flex;
  align-items: center;
  gap: var(--s-3_5);
  min-width: 0;
}

.toolbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
h2 {
  margin: 0;
}
#deleteBtn {
  margin-right: auto;
}

.li-thumb--empty {
  background: transparent;
}

.cover-fallback{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.6rem;
  background: linear-gradient(135deg, rgba(255,255,255,.6), rgba(0,0,0,.05));
  color: rgba(0,0,0,.55);
}
body.dark .cover-fallback{color: rgba(255,255,255,.75)}

.fav-btn{padding:.35rem .55rem; line-height:1}

.fav-overlay{
  position:absolute;
  top:var(--s-2);
  right:var(--s-2);
  width:var(--s-7);
  height:var(--s-7);
  border:none;
  border-radius:50%;
  background:rgba(0,0,0,.55);
  cursor:pointer;

  display:grid;
  place-items:center;

  font-size:18px;
  line-height:1;

  color: rgba(255,255,255,.85); /* default: nicht-fav */
  text-shadow: 0 1px 10px rgba(0,0,0,.65);

  transition: background var(--t-fast, 120ms ease), transform var(--t-snappy, 60ms ease), color var(--t-fast, 120ms ease);
}

.fav-overlay:hover{ background:rgba(0,0,0,.65); }
.fav-overlay:active{ transform:scale(.96); }

.fav-overlay.is-fav{
  color: var(--primary);
  text-shadow:
    0 1px 6px rgba(0,0,0,.6),
    0 0 8px rgba(227,192,141,.35);
}

.fav-inline{
  border: none;
  background: transparent;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 1.05rem;
  line-height: 1;
  padding: .2rem .35rem;

  border-radius: var(--r-0);
  width: 1.6rem;
  color: var(--muted);
  transition:
    color var(--t-fast, 120ms ease),
    background var(--t-fast, 120ms ease),
    transform var(--t-snappy, 60ms ease);
}

/* hover: very subtle */
.fav-inline:hover{
  background: rgba(0,0,0,.06);
}

html.dark .fav-inline:hover{
  background: rgba(255,255,255,.08);
}

/* active press */
.fav-inline:active{
  transform: scale(.94);
}

@keyframes fav-pop {
  0%   { transform: scale(.9); }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.fav-inline.is-fav{
  color: var(--primary);
  text-shadow:
    0 1px 1px rgba(0,0,0,.4),
    0 0 8px rgba(227,192,141,.45),
    0 0 14px rgba(227,192,141,.25);
}




/* optional: nicer focus */
.fav-inline:focus-visible{
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-soft);
}


:where(.fav-inline,.fav-overlay){
  -webkit-user-select:none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}






.li-body {
  min-width: 0;
}

.li-title {
  font-weight: 750;
  font-size: 1.1rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.li-sub {
  margin-top: var(--s-1);
  color: var(--muted);
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.li-chev {
  color: #9aa;
  font-size: 1.6rem;
  padding-left: var(--s-2);
  flex: 0 0 auto;
  -webkit-user-select:none;
  user-select: none;
}

.list-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--cat-accent, #dfe);
  opacity: 0.45;
}

.li-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--r-1_5);
  object-fit: cover;
  display: block;
  background: transparent;
  flex: 0 0 auto;
}

.li-thumb--empty {
  background: #eee;
}

.li-title {
  font-weight: 750;
  font-size: 1.05rem;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.li-sub {
  color: var(--muted);
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.li-chev {
  color: #9aa;
  font-size: 1.6rem;
  line-height: 1;
  padding-left: var(--s-1_5);
  flex: 0 0 auto;
}
/* --- Pills (used for meta + overlays like pending) --- */

/* Legacy button classnames (kept for markup compatibility) */
.btn-primary { 
  background: var(--primary);
  color: #111;
  border: 0;
}
.btn-ghost { 
  background: rgba(210,179,123,0.14);
  color: var(--text);
  border: 1px solid rgba(210,179,123,0.40);
}
body.dark .btn-ghost{ background: rgba(210,179,123,0.10); }

.topbar {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: .75rem;
  z-index: var(--z-floating);
}

.fab-menu{
  position:fixed;
  right:var(--s-4);
  bottom:84px;
  display:flex;
  flex-direction:column;
  gap:var(--s-2);
  z-index: calc(var(--z-floating) + 40);
  padding: var(--s-2);
  min-width: 180px;
}
.fab-menu__item{
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}
.fab-menu__item:focus{
  outline: none;
}

/* --- Thumbnails: square crops in list + grid --- */
.li-media{
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  position: relative;
  border-radius: var(--r-1);
  overflow: hidden;
}
.li-thumb{
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

/* Grid: square media area (responsive) */
.grid-media{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-1);
  overflow: hidden;
}
.grid-img{
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  display: block;
  z-index: var(--z-base);
  border-radius: var(--r-1);
}

/* === Bottom Sheet / Overlay === */
/* Cook: Steps als Cards mit Abstand */
.steps-checklist{
  list-style: none;
  padding: 0;
  margin: 0;
}
.steps-checklist > li{
  margin: 0 0 var(--s-4);
  padding: var(--s-4);
  border-radius: var(--r-3);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}
.steps-checklist > li:last-child{ margin-bottom: 0; }

/* List: Favorit rechts neben Bild, vor Titel */
.li-title-row{
  display:flex;
  align-items:center;
  gap:.5rem;
}


/* Cookbar Timer Dock */
#timerDock{ display:flex; justify-content:center; }
.timerdock-chip{
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--r-pill);
  padding: .45rem .65rem;
  display:flex;
  align-items:center;
  gap:.5rem;
  box-shadow: var(--shadow-1);
}
.timerdock-label{ font-weight: 900; }
.timerdock-count{
  font-size:.85rem;
  font-weight:900;
  border-radius: var(--r-pill);
  padding:.1rem .45rem;
  border:1px solid var(--line);
  background: rgba(0,0,0,.04);
}
html.dark .timerdock-count{ background: rgba(255,255,255,.06); }

.timerdock-panel{
  position: fixed;
  left: var(--s-4);
  right: var(--s-4);
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom) + var(--cookbar-h, 96px));
  z-index: calc(var(--z-sheet) + 1);
}

/* Timerbar docked inside cookbar */
.timerroot-dock{
  flex: 1;
  display:flex;
  justify-content:center;
  min-width: 0;
}
.timerroot-dock .timerbar{
  width: 100%;
  max-width: 520px;
  margin: 0;
  padding: .25rem .5rem;
}
.timerroot-dock .timer-list{
  margin-top: .2rem;
}
.timerroot-dock .timer-pill{
  padding: .3rem .45rem;
  align-items: center;
  gap: .5rem;
}
.timerroot-dock .timer-pill-title{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timerroot-dock .timer-actions button{
  padding: .2rem .35rem;
  font-size: .85rem;
}
.timerroot-dock .timer-actions{
  display: none;
}
.timerroot-dock .timer-pill.is-open .timer-actions{
  display: flex;
}
.timerroot-dock .timer-pill{
  cursor: pointer;
}
.timerroot-dock .timer-toggle--mini{
  padding: .2rem .4rem;
  font-size: .8rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(0,0,0,.05);
  color: var(--text);
  margin-left: .35rem;
}
html.dark .timerroot-dock .timer-toggle--mini{
  background: rgba(255,255,255,.08);
}

/* Ingredients sheet: mark + auto-hide */
.ingredients-list.is-interactive{
  list-style: none;
  padding-left: 0;
  margin: .25rem 0 0;
}
.ingredients-list.is-interactive .ingredient-item{
  cursor: pointer;
  padding: .15rem 0;
  border-radius: var(--r-0);
}
.ingredients-list.is-interactive .ingredient-item:hover{
  background: rgba(0,0,0,.04);
}
html.dark .ingredients-list.is-interactive .ingredient-item:hover{
  background: rgba(255,255,255,.06);
}
.ingredients-list.is-interactive .ingredient-item.is-used{
  color: var(--muted);
}
.ingredients-list.is-interactive .ingredient-item.is-hidden{
  display: none;
}
.ingredients-list.is-interactive .ingredient-item.is-pending-hide{
  opacity: .7;
}
.ingredients-toggle{
  min-height: 26px;
  padding: 0 .4rem;
  font-size: .85rem;
}
.timerroot-dock .timer-pill-left{
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}
.timerroot-dock .timer-pill-left .muted{
  font-size: .85rem;
  white-space: nowrap;
}
.timerroot-dock .timer-more-hint{
  display: none;
}

.li-media,.grid-media{ position:relative; }

.todo-ribbon{
  position: absolute;
  top: 8px;
  right: -28px;
  z-index: 2;
  width: 110px;
  text-align: center;
  transform: rotate(34deg);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #1a1a1a;
  background: rgba(214, 184, 132, .88);
  border: 1px solid rgba(120, 95, 58, .45);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  pointer-events: none;
}
html.dark .todo-ribbon{
  color: #111;
  background: rgba(232, 203, 153, .9);
  border-color: rgba(255, 231, 185, .35);
}
