/* ─────────────────────────────────────────────────────────────
   Avena Receta — re-skin con el sistema de diseño de /especialista
   (tokens Figtree + azul #155DFC). Se carga DESPUÉS de las hojas
   existentes para sobreescribir el look sin tocar el markup.
   ───────────────────────────────────────────────────────────── */

:root {
  --primary: #155DFC;
  --primary-hover: #0F46C8;
  --blue-100: #EDF2FF;
  --fg: #111827;
  --fg-muted: #6A7282;
  --fg-subtle: #B3B3B3;
  --canvas: #F5F7FA;
  --surface: #F8FAFC;
  --line: #EEF1F5;
  --border: #E7E7E7;
  --shadow-card: 0 4px 24px rgba(17, 24, 39, 0.05);
  --shadow-rail: 0 8px 32px rgba(17, 24, 39, 0.07);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --rd-font: 'Figtree', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── base ── */
body {
  font-family: var(--rd-font);
  letter-spacing: -0.02em;
  color: var(--fg);
  background-color: var(--canvas);
  background-image: radial-gradient(#D7DDE7 1.1px, transparent 1.1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}

/* ── header ── */
header {
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.header__avena {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 20px;
  min-height: 64px;
}

.header__avena a img {
  max-width: none;
  width: auto;
  height: 40px;
}

/* ── main container ── */
.box__body {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ── hero ── */
.hero__container {
  margin: 24px auto 8px;
}

.hero__container h1 {
  font-family: var(--rd-font);
  font-size: 30px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
  max-width: 720px;
  margin: 8px auto 0;
}

.search__container {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 28px auto 8px;
  padding: 14px 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9999px;
  box-shadow: var(--shadow-rail);
  box-sizing: border-box;
}

.search__container input {
  min-width: 0;
}

.search__container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 93, 252, 0.12);
}

/* home search: full width */
.box__body > #searchForm,
.hero__container > #searchForm {
  max-width: none;
  width: 100%;
  margin: 24px 0;
}

.search__container input {
  font-family: var(--rd-font);
  font-size: 15px;
  color: var(--fg);
}

.search__container input::placeholder {
  color: var(--fg-muted);
}

.search__container img {
  margin-right: 0;
  opacity: 0.7;
}

/* ── recipe cards grid ── */
.recipes__grid,
.recipes__gridCustom {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
}

.recipe__container {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 180ms var(--ease), transform 180ms var(--ease);
}

.recipe__container:hover {
  box-shadow: var(--shadow-rail);
  transform: translateY(-2px);
}

.recipe__container .recipe__image {
  border-radius: 0;
  aspect-ratio: 1 / 0.82;
  margin-bottom: 0;
}

/* ── recipe detail layout ──
   Vertical stack: full-width search → 2-col hero (image | title/author/buttons)
   → full-width content (macros, ingredients, …). */
.recipeDetail__layoutContainer {
  display: block;
}

/* full-width search on top */
.recipeDetail__layoutContainer > #searchForm {
  width: 100%;
  max-width: none;
  margin: 0 0 24px;
}

/* hide the duplicate mobile image (the hero image handles all sizes now) */
.recipe__imageContainer--mobile {
  display: none !important;
}

/* 2-column hero */
.recipeDetail__hero {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.recipeDetail__hero .recipe__imageContainer {
  flex: 0 0 300px;
  width: 300px;
  height: auto;
  margin: 0;
}

.recipeDetail__hero .recipe__imageContainer .recipe__image {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  margin: 0;
}

.recipeDetail__heroInfo {
  flex: 1 1 auto;
  min-width: 0;
}

.recipeDetail__heroInfo > h1#title {
  margin-top: 0;
  margin-bottom: 0;
}

/* the rest is full width */
.recipeDetail__information {
  width: 100%;
  padding: 0;
}

/* each content section as a white card (except "Quizás", whose recipes are already cards) */
.recipeDetail__information .recipeDetail__ingredientsContainer,
.recipeDetail__information .recipeDetail__preparationContainer,
.recipeDetail__information .faq__container,
.recipeDetail__information #section__premium > div:first-child {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 24px;
  margin-bottom: 20px;
}

/* "Quizás te pueda interesar": no section card, add spacing below */
.recipeDetail__information .ingredients__relatedContaine {
  margin-bottom: 20px;
}

/* section card headings: no top margin */
.recipeDetail__information .recipeDetail__ingredientsContainer > h2,
.recipeDetail__information .recipeDetail__preparationContainer > h2,
.recipeDetail__information .faq__container > h2,
.recipeDetail__information #section__premium #microsLabel {
  margin-top: 0;
}

/* remove the dashed dividers inside the cards */
.recipeDetail__information .recipeDetail__preparationContainer ol,
.recipeDetail__information .recipeDetail__ingredientsContainer,
.recipeDetail__information .faq__container {
  border-bottom: none;
}

/* let the premium section stack its cards with spacing */
.recipeDetail__information #section__premium {
  display: block;
}

/* ingredient row: [input] [image] [name / unit stacked] [shop] */
.recipeDetail__ingredientsContainer .ingredient__info--row {
  height: auto;
}

.ingredient__inputContainer .ingredientName__container,
.ingredient__inputContainer .ingredient__detailWrapper {
  display: contents;
}

.ingredient__inputContainer {
  display: grid;
  grid-template-columns: 68px 34px 1fr auto auto;
  grid-template-areas:
    "input image name view shop"
    "input image unit view shop";
  align-items: center;
  column-gap: 10px;
  row-gap: 0;
}

.ingredient__inputContainer .ingredient__view {
  grid-area: view;
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #fff;
  font-family: var(--rd-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

.ingredient__inputContainer .ingredient__view:hover {
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
}

.ingredient__inputContainer .ingredient__info--input {
  grid-area: input;
  margin-right: 0;
}

.ingredient__inputContainer .ingredientDetail__image {
  grid-area: image;
  align-self: start;
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 8px;
}

.ingredient__inputContainer .ingredientName__container > a {
  grid-area: name;
  align-self: end;
}

/* ingredients without image/input (e.g. Sal): align name in the name column, centered */
.ingredient__inputContainer .ingredientName__container--emptyImage > .ingredient__name {
  grid-area: name;
  grid-row: 1 / 3;
  align-self: center;
  margin-left: 0;
  font-size: 12px;
}

.ingredient__inputContainer .ingredient__unity {
  grid-area: unit;
  align-self: start;
}

.ingredient__inputContainer .ingredient__buy {
  grid-area: shop;
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: #fff;
  font-family: var(--rd-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

.ingredient__inputContainer .ingredient__buy:hover {
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
}

.recipeDetail__heroInfo .macros__sectionContainer {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-top: 16px;
  margin-bottom: 0;
}

.macros__sectionContainer > h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.macros__sectionContainer .macrosInfo__container {
  margin-top: 0;
  row-gap: 0;
  column-gap: 8px;
}

.macros__sectionContainer .macrosInfo__item {
  padding: 4px 8px;
}

.macros__sectionContainer .macrosInfo__item p,
.macros__sectionContainer .macrosInfo__item h2 {
  font-size: 12px !important;
}

.recipeDetail__heroInfo .cta__container {
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.recipe__container p {
  font-family: var(--rd-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--fg);
  padding: 12px 14px 14px;
}

.recipe__saveIcon {
  top: 12px;
  right: 12px;
  padding: 7px;
  background: var(--primary);
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(21, 93, 252, 0.35);
}

/* related recipes ("Quizás te pueda interesar"): 3 per row, white cards */
.ingredients__relatedContaine .recipes__grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* each related item = one white card (image + title inside) */
.ingredients__relatedContaine .recipes__grid > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 180ms var(--ease), transform 180ms var(--ease);
}

.ingredients__relatedContaine .recipes__grid > div:hover {
  box-shadow: var(--shadow-rail);
  transform: translateY(-2px);
}

/* the inner anchor is no longer its own card */
.ingredients__relatedContaine .recipe__container {
  display: block;
  position: relative;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.ingredients__relatedContaine .recipe__container:hover {
  box-shadow: none;
  transform: none;
}

.ingredients__relatedContaine .recipe__container .recipe__image {
  display: block;
  width: 100%;
  border-radius: 0;
  aspect-ratio: 1 / 0.82;
  margin-bottom: 0;
}

/* title inside the card, clamped to 2 lines */
.ingredients__relatedContaine .recipes__grid > div > p {
  margin: 0 !important;
  padding: 12px 14px 14px !important;
  font-family: var(--rd-font) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 20px !important;
  color: var(--fg) !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis;
  /* hard cap: 2 lines (40px) + top/bottom padding (26px) — works even if line-clamp is unsupported */
  max-height: 66px !important;
}

/* ── harmonize native buttons with the design system ── */
button {
  font-family: var(--rd-font);
  letter-spacing: -0.02em;
}

button[type="primary"] {
  background: var(--primary);
  border-radius: 9999px;
}

/* recipe-detail "Plan" CTA: match the pill/border of the other CTA buttons */
.cta__container #createPlanButton {
  border-radius: 8px;
}

button[type="primary"]:hover {
  background: var(--primary-hover);
}

button[type="secondary"] {
  border-radius: 9999px;
}

/* ── primary buttons / view more ── */
.viewMore__container {
  margin-top: 40px;
}

.viewMore__container .button__createAccount,
.button__createAccount {
  height: 52px;
  padding: 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 9999px;
  background: var(--primary);
  color: #fff;
  font-family: var(--rd-font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background 160ms var(--ease);
}

.viewMore__container .button__createAccount:hover,
.button__createAccount:hover {
  background: var(--primary-hover);
}

/* ── footer ── */
footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 40px 20px 24px;
}

footer h3 {
  font-family: var(--rd-font);
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
}

footer a {
  font-family: var(--rd-font);
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 2;
}

footer a:hover {
  color: var(--primary);
}

footer p {
  font-family: var(--rd-font);
  color: var(--fg-subtle);
  font-size: 13px;
}

/* align the footer logo to the top of its column */
footer .footer__insideContainer {
  align-items: start;
}

footer .footer__insideContainer > a {
  margin: 0;
  align-self: start;
}

/* ── responsive ── */
/* recipe detail hero: narrow the image column on tablet */
@media (max-width: 1024px) {
  .recipeDetail__hero .recipe__imageContainer {
    flex: 0 0 260px;
    width: 260px;
  }
}

/* recipe detail hero: stack (image on top) on small screens */
@media (max-width: 767px) {
  .recipeDetail__hero {
    flex-direction: column;
  }

  .recipeDetail__hero .recipe__imageContainer {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
  }

  .recipeDetail__hero .recipe__imageContainer .recipe__image {
    height: 280px;
    aspect-ratio: auto;
  }
}

@media (max-width: 640px) {
  .hero__container h1 {
    font-size: 30px;
  }

  .recipes__grid,
  .recipes__gridCustom {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}
