/* ---------- Opening screen (installed app only) ----------
   Android shows its own splash with the icon only; this one follows it with the name in Pacifico. */
.splash { display: none; }
@media (display-mode: standalone) {
  .splash {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-content: center; justify-items: center; gap: 12px;
    background: var(--ivoire);
    transition: opacity 400ms ease, visibility 400ms;
  }
  .splash.is-done { opacity: 0; visibility: hidden; }
}
.splash__logo { width: min(58vw, 260px); height: auto; }
.splash__name { font-family: var(--font-titre); font-size: min(9vw, 2.6rem); color: var(--encre); }

/* ---------- Layout shell ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
}
.site-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { text-decoration: none; display: flex; align-items: center; min-height: 44px; }
.brand__logo { height: 112px; width: auto; padding-block: 6px; }
@media (min-width: 720px) { .brand__logo { height: 124px; } }
/* On phones the header scrolls away with the page: the bottom bar keeps the navigation at hand. */
@media (max-width: 719px) {
  .site-header { position: static; }
  /* Phones: the logo is centred (navigation lives in the bottom bar). */
  .site-header__inner { justify-content: center; }
}

.main-nav { display: flex; gap: var(--space-1); }
.main-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 700;
  color: var(--text-muted);
}
.main-nav__link:hover { color: var(--text); background: var(--surface-tint); }
.main-nav__link[aria-current="page"] { color: var(--text); background: var(--peche); }

/* Phone: the navigation becomes a bottom bar within thumb reach. */
@media (max-width: 719px) {
  .main-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    justify-content: space-around;
    gap: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: var(--space-1) max(8px, env(safe-area-inset-right, 0px)) calc(var(--space-1) + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }
  .main-nav__link {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-md);
    font-size: var(--fs-label);
    letter-spacing: 0.02em;
  }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding-block: var(--space-4) var(--space-6);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.site-main:focus { outline: none; }

.site-footer {
  padding-block: var(--space-4);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-small);
  border-top: 1px solid var(--line);
}

.site-footer__name { display: block; font-family: var(--font-titre); font-size: 1.25rem; color: var(--text); margin-bottom: 2px; }
.site-footer__firma { display: block; white-space: nowrap; }
.site-footer__heart { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; color: var(--tomate); fill: var(--tomate); }

.loading { color: var(--text-muted); padding-block: var(--space-5); text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-4);
  border: 2px solid var(--edge);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--edge-shadow);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--edge-shadow); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--edge-shadow); }

.btn--quiet {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  box-shadow: none;
}
.btn--quiet:hover { border-color: var(--text-muted); box-shadow: none; transform: none; }
.btn--quiet:active { transform: none; box-shadow: none; }
.btn--quiet[aria-pressed="true"] {
  background: var(--basilic);
  border-color: var(--basilic);
  color: var(--ivoire);
}
.btn--fav[aria-pressed="true"] {
  background: var(--tomate);
  border-color: var(--tomate);
  color: var(--ivoire);
}
.btn--fav[aria-pressed="true"] .icon { fill: currentColor; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
}
.icon-btn:hover { background: var(--surface-tint); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 44px;
  margin-left: calc(var(--space-2) * -1);
  padding-right: var(--space-3);
  color: var(--text-muted);
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover { color: var(--text); }

/* ---------- Search ---------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 18px;
  color: var(--text-muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  min-height: 56px;
  padding: 0 var(--space-3) 0 52px;
  border: 2px solid var(--edge);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 1.0625rem;
  box-shadow: 3px 3px 0 var(--edge-shadow);
}
.search input::placeholder { color: var(--text-muted); opacity: 1; }
.search input:focus-visible { outline-offset: 4px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- Chips (category filters) ---------- */
.chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) 2px var(--space-2);
  scrollbar-width: none;
  margin-inline: -2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 0.9375rem;
  white-space: nowrap;
}
.chip:hover { border-color: var(--text-muted); }
.chip[aria-current="page"] {
  background: var(--encre);
  border-color: var(--encre);
  color: var(--ivoire);
}
.chip__count { font-weight: 600; opacity: 0.75; font-variant-numeric: tabular-nums; }

/* ---------- Card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: var(--space-3);
  list-style: none;
}
/* Shared card look (categories and recipes): soft border, category tint,
   and on hover a light rising from the top edge, a Corail border and a small lift. */
.card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1.5px solid rgba(38, 38, 38, 0.16);
  border-radius: var(--radius-md);
  background: var(--tile, var(--surface-tint));
  text-decoration: none;
  color: var(--text);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 90% at 50% -10%, rgba(255, 253, 248, 0.85), rgba(255, 253, 248, 0) 65%);
  opacity: 0;
  transition: opacity 260ms ease;
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--corail);
  box-shadow: 0 14px 28px -14px rgba(165, 63, 50, 0.45);
}
.card:hover::before, .card:focus-visible::before { opacity: 1; }
.card:active { transform: translateY(-1px); }
.card[data-cat="tartas"] { --tile: var(--cat-tartas); }
.card[data-cat="flanes"] { --tile: var(--cat-flanes); }
.card[data-cat="salados"] { --tile: var(--cat-salados); }
.card[data-cat="fritos"] { --tile: var(--cat-fritos); }
.card[data-cat="conservas"] { --tile: var(--cat-conservas); }
.card__icon {
  width: 36px;
  height: 36px;
  flex: none;
  transition: transform 220ms ease;
}
.card:hover .card__icon { transform: scale(1.08); }

/* ---------- Recipe card ---------- */
.recipe-card {
  height: 100%;
  min-height: 148px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  gap: var(--space-2) var(--space-2);
  padding: var(--space-3);
}
.recipe-card__head {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.recipe-card .card__icon { width: 28px; height: 28px; }
.recipe-card__cat {
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.recipe-card__fav {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  color: var(--tomate);
}
.recipe-card__fav .icon { fill: currentColor; width: 20px; height: 20px; }
.recipe-card__title {
  grid-column: 1 / -1;
  align-self: end;
  font-family: var(--font-titre);
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--encre);
}
.recipe-card__meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--text);
}
.recipe-card__meta span { display: inline-flex; align-items: center; gap: 6px; }
.recipe-card__meta .icon { width: 18px; height: 18px; }

/* ---------- Facts (oven, time, cold, servings) ---------- */
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
}
.fact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-weight: 700;
  font-size: 0.9375rem;
}
.fact .icon { color: var(--basilic); width: 20px; height: 20px; }

/* ---------- Callout & empty states ---------- */
.callout {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 2px dashed var(--text-muted);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.9375rem;
}
.callout .icon { color: var(--text-muted); margin-top: 2px; }
.callout strong { display: block; font-weight: 800; }

.empty {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-3);
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-muted);
}
.empty h2 { font-size: 1.5rem; }
.empty p { max-width: 42ch; }

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.section-head a { font-weight: 700; color: var(--text); text-underline-offset: 4px; }

