/* Recipes ("الوصفات"): public list + detail (route-scoped, loaded by app/recipes/layout.tsx).
   Arabic-first RTL: logical properties only; Western numerals; line-height ≥ 1.6; touch targets ≥ 48px. */

.recipes-page .recipes-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto 48px; display: grid; gap: 22px; }
.recipes-page h1, .recipes-page h2, .recipes-page h3 { font-style: normal; }
.recipes-page p { line-height: 1.7; }

/* Hero + search */
.recipes-hero { display: grid; gap: 12px; padding: 28px 24px; border-radius: 28px; background: linear-gradient(135deg, #fff4e8 0%, #fffaf2 55%, #f3f8f4 100%); border: 1px solid rgba(85, 62, 45, .1); text-align: start; }
.recipes-kicker { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 6px 12px; border-radius: 999px; background: #fff; color: var(--green); font-weight: 800; font-size: 13px; border: 1px solid #d9e9df; }
.recipes-kicker svg, .recipes-chip svg, .recipe-card-meta svg, .recipe-facts svg, .recipe-action svg, .recipe-order-button svg, .recipes-filter-toggle svg, .recipes-reset svg, .recipe-crumb-sep { width: 18px; height: 18px; flex: none; }
.recipes-hero h1 { margin: 0; font-size: clamp(30px, 5vw, 46px); line-height: 1.2; letter-spacing: -.01em; }
.recipes-hero > p { margin: 0; max-width: 62ch; color: var(--muted); font-size: 16px; }
.recipes-search { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 6px 6px 14px; border-radius: 20px; background: #fff; border: 1.5px solid #e4d9cb; box-shadow: 0 10px 30px rgba(58, 38, 23, .08); }
.recipes-search:focus-within { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(240, 90, 36, .14); }
.recipes-search > svg { width: 22px; height: 22px; color: var(--muted); }
.recipes-search input { min-height: 50px; border: 0; background: transparent; font: inherit; font-size: 17px; color: inherit; outline: none; min-width: 0; }
.recipes-search input::-webkit-search-cancel-button { display: none; }
.recipes-clear { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: #f6f1ea; color: var(--muted); cursor: pointer; }
.recipes-clear svg { width: 18px; height: 18px; }
.recipes-search-go { min-height: 48px; padding: 0 20px; border: 0; border-radius: 14px; background: var(--orange); color: #fff; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }

/* Category chips */
.recipes-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.recipes-chips::-webkit-scrollbar { display: none; }
.recipes-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid #e4d9cb; background: #fff; color: inherit; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.recipes-chip small { padding: 1px 7px; border-radius: 999px; background: #f6f1ea; color: var(--muted); font-size: 12px; }
.recipes-chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.recipes-chip.is-active small { background: rgba(255, 255, 255, .18); color: #fff; }

/* Toolbar + filters */
.recipes-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.recipes-filter-toggle, .recipes-reset { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 16px; border-radius: 14px; border: 1px solid #e4d9cb; background: #fff; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; color: inherit; }
.recipes-filter-toggle b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 12px; }
.recipes-reset { color: #9a3412; border-style: dashed; }
.recipes-count { color: var(--muted); font-weight: 700; margin-inline-start: auto; }
.recipes-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 16px; border-radius: 20px; background: #fff; border: 1px solid var(--line); }
.recipes-filters label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
.recipes-filters select { min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px solid #dcd3c5; background: #fff; font: inherit; font-size: 15px; color: inherit; }

/* Featured collections */
.recipes-collections { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.recipes-collection { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 80px; padding: 10px 12px; border-radius: 18px; border: 1px solid #e4d9cb; background: linear-gradient(135deg, #fff, #fff7ef); text-align: start; font: inherit; color: inherit; cursor: pointer; }
.recipes-collection img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; }
.recipes-collection span { display: grid; gap: 2px; min-width: 0; }
.recipes-collection b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipes-collection small { color: var(--muted); font-size: 13px; }

/* Grid + cards */
.recipes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 18px; }
.recipe-card { display: grid; grid-template-rows: auto 1fr; border-radius: 22px; overflow: hidden; background: #fff; border: 1px solid rgba(85, 62, 45, .1); box-shadow: 0 10px 30px rgba(58, 38, 23, .06); color: inherit; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.recipe-card:hover, .recipe-card:focus-visible { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(58, 38, 23, .12); outline: none; }
.recipe-card:focus-visible { box-shadow: 0 0 0 4px rgba(240, 90, 36, .35); }
.recipe-card-media, .recipe-cover { position: relative; aspect-ratio: 4 / 3; background: #f3ece2; display: grid; place-items: center; overflow: hidden; }
.recipe-card-media img, .recipe-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-card-media > svg, .recipe-cover > svg { width: 44px; height: 44px; color: #c9b8a3; }
.recipe-card-media.is-placeholder, .recipe-cover.is-placeholder { background: linear-gradient(135deg, #fde7d3, #f3ece2); }
.recipe-card-media.is-placeholder[data-category="pastry"], .recipe-card-media.is-placeholder[data-category="dessert"], .recipe-cover.is-placeholder[data-category="pastry"], .recipe-cover.is-placeholder[data-category="dessert"] { background: linear-gradient(135deg, #fde2e9, #fff1d6); }
.recipe-card-media.is-placeholder[data-category="soup"], .recipe-card-media.is-placeholder[data-category="tajine"], .recipe-cover.is-placeholder[data-category="soup"], .recipe-cover.is-placeholder[data-category="tajine"] { background: linear-gradient(135deg, #fcd5c3, #ffe9d6); }
.recipe-card-media.is-placeholder[data-category="salad"], .recipe-card-media.is-placeholder[data-category="vegetarian"], .recipe-cover.is-placeholder[data-category="salad"], .recipe-cover.is-placeholder[data-category="vegetarian"] { background: linear-gradient(135deg, #dcefe2, #f3f8f4); }
.recipe-badge { position: absolute; inset-block-start: 10px; inset-inline-start: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; background: rgba(23, 32, 28, .82); color: #fff; font-size: 12px; font-weight: 800; font-style: normal; backdrop-filter: blur(4px); }
.recipe-badge svg { width: 14px; height: 14px; }
.recipe-badge-pro { inset-inline-start: auto; inset-inline-end: 10px; background: linear-gradient(135deg, #b45309, #f59e0b); }
.recipe-card-body { display: grid; gap: 6px; padding: 14px 16px 16px; }
.recipe-card-kicker { color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.recipe-card-body b { font-size: 17px; line-height: 1.45; }
.recipe-card-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-card-meta { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 4px; color: #4b5550; font-size: 13px; font-weight: 700; }
.recipe-card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.recipe-card-meta svg { width: 16px; height: 16px; color: var(--orange); }

/* States */
.recipes-empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; border-radius: 24px; background: #fff; border: 1px dashed #d6c9b8; text-align: center; }
.recipes-empty svg { width: 48px; height: 48px; color: #c9b8a3; }
.recipes-empty h2 { margin: 0; font-size: 22px; }
.recipes-empty p { margin: 0; color: var(--muted); }
.recipes-error { padding: 12px 14px; border-radius: 14px; background: #fff1ee; color: #b42318; border: 1px solid #f4b4a8; font-weight: 700; }
.recipes-more { display: grid; justify-items: center; }
.recipes-more-button { min-height: 52px; padding: 12px 32px; border-radius: 16px; border: 1px solid #e4d9cb; background: #fff; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; color: inherit; }
.recipes-more-button:disabled { opacity: .6; cursor: progress; }

/* Detail */
.recipe-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 700; }
.recipe-crumbs a { color: var(--green); text-decoration: none; }
.recipe-crumb-sep { width: 16px; height: 16px; }
[dir="rtl"] .recipe-crumb-sep { transform: scaleX(-1); }
.recipe-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; align-items: start; }
.recipe-cover { border-radius: 26px; box-shadow: 0 18px 44px rgba(58, 38, 23, .12); }
.recipe-head-text { display: grid; gap: 12px; }
.recipe-head-text h1 { margin: 0; font-size: clamp(28px, 4.5vw, 42px); line-height: 1.22; }
.recipe-summary { margin: 0; color: #4b5550; font-size: 17px; }
.recipe-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.recipe-facts li { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.recipe-facts svg { width: 22px; height: 22px; color: var(--orange); }
.recipe-facts span { display: grid; }
.recipe-facts small { color: var(--muted); font-size: 12px; }
.recipe-facts b { font-size: 15px; }
.recipe-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.recipe-tags a { display: inline-block; padding: 5px 10px; border-radius: 999px; background: #f6f1ea; color: #6b4b2f; font-size: 13px; font-weight: 700; text-decoration: none; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.recipe-action { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-radius: 14px; border: 1px solid #e4d9cb; background: #fff; color: inherit; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; text-decoration: none; }
.recipe-action-video { background: var(--ink); color: #fff; border-color: var(--ink); }
.recipe-video { position: relative; aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden; background: #000; box-shadow: 0 18px 44px rgba(0, 0, 0, .25); }
.recipe-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.recipe-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px; align-items: start; }
.recipe-ingredients, .recipe-steps { display: grid; gap: 14px; padding: 20px; border-radius: 24px; background: #fff; border: 1px solid rgba(85, 62, 45, .1); box-shadow: 0 14px 40px rgba(58, 38, 23, .06); }
.recipe-ingredients { position: sticky; top: 16px; }
.recipe-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.recipe-ingredients h2, .recipe-steps h2, .recipe-related h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 21px; }
.recipe-ingredients h2 svg, .recipe-steps h2 svg { width: 22px; height: 22px; color: var(--orange); }
.recipe-servings { display: inline-flex; align-items: center; border: 1px solid #dcd3c5; border-radius: 16px; overflow: hidden; background: #fff; }
.recipe-servings button { display: inline-grid; place-items: center; width: 48px; min-height: 48px; border: 0; background: #fff7ef; color: inherit; cursor: pointer; }
.recipe-servings button:disabled { opacity: .4; cursor: not-allowed; }
.recipe-servings button svg { width: 20px; height: 20px; }
.recipe-servings output { display: grid; justify-items: center; min-width: 76px; padding: 4px 10px; line-height: 1.1; }
.recipe-servings output b { font-size: 20px; }
.recipe-servings output small { color: var(--muted); font-size: 11px; }
.recipe-scaled-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff4e6; color: #6b4b2f; font-size: 14px; }
.recipe-scaled-note button { border: 0; background: transparent; color: #9a3412; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.recipe-ingredient-group h3 { margin: 6px 0 4px; color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.recipe-ingredient-group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.recipe-ingredient-group li label { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 10px; min-height: 48px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.recipe-ingredient-group li label:hover { background: #faf6f0; }
.recipe-ingredient-group input { width: 22px; height: 22px; align-self: center; accent-color: var(--green); }
.recipe-ingredient-qty { min-width: 56px; color: #9a3412; font-weight: 800; font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.recipe-ingredient-name { font-size: 16px; line-height: 1.6; }
.recipe-ingredient-name em { color: var(--muted); font-style: normal; font-size: 14px; }
.recipe-ingredient-group li.is-checked .recipe-ingredient-name, .recipe-ingredient-group li.is-checked .recipe-ingredient-qty { text-decoration: line-through; color: #a39a8d; }
.recipe-locked-note { display: flex; align-items: center; gap: 8px; margin: 0; color: #b45309; font-weight: 700; }
.recipe-locked-note svg { width: 18px; height: 18px; }
.recipe-order { display: grid; gap: 10px; margin-top: 6px; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, #fff4e6, #fffaf2); border: 1px solid #f5d9b4; }
.recipe-order p { margin: 0; color: #6b4b2f; font-size: 14px; }
.recipe-order-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 18px; border-radius: 16px; background: var(--orange); color: #fff; font-weight: 800; font-size: 16px; text-decoration: none; box-shadow: 0 10px 24px rgba(240, 90, 36, .25); }
.recipe-order-button svg { width: 20px; height: 20px; }

.recipe-steps ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; counter-reset: step; }
.recipe-steps li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 14px; border-radius: 18px; background: #fffaf5; border: 1px solid #f1e6d8; scroll-margin-top: 16px; }
.recipe-step-number { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 17px; font-weight: 900; }
.recipe-steps li p { margin: 0; font-size: 17px; line-height: 1.8; }
.recipe-steps li small { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--muted); font-weight: 700; }
.recipe-steps li small svg { width: 14px; height: 14px; }
.recipe-steps li img { display: block; width: 100%; margin-top: 10px; border-radius: 14px; }
.recipe-paywall { display: grid; justify-items: center; gap: 10px; padding: 28px 20px; border-radius: 20px; text-align: center; background: linear-gradient(180deg, rgba(255, 250, 242, 0) 0%, #fff4e6 30%); border: 1px dashed #f0b86e; margin-top: -40px; position: relative; }
.recipe-paywall > svg { width: 36px; height: 36px; color: #b45309; }
.recipe-paywall h3 { margin: 0; font-size: 20px; }
.recipe-paywall p { margin: 0; color: #6b4b2f; max-width: 48ch; }
.recipe-collections-line { margin: 0; color: var(--muted); font-weight: 700; display: flex; flex-wrap: wrap; gap: 8px; }
.recipe-collections-line a { color: var(--green); }
.recipe-related { display: grid; gap: 14px; }
.recipe-print-only { display: none; }

@media (max-width: 860px) {
  .recipe-head, .recipe-columns { grid-template-columns: minmax(0, 1fr); }
  .recipe-ingredients { position: static; }
  .recipes-search { grid-template-columns: auto minmax(0, 1fr) auto; }
  .recipes-search-go { grid-column: 1 / -1; min-height: 50px; }
  .recipes-count { margin-inline-start: 0; }
}
@media (max-width: 480px) {
  .recipes-page .recipes-shell { width: calc(100% - 24px); }
  .recipes-hero { padding: 22px 16px; border-radius: 22px; }
  .recipes-grid { grid-template-columns: minmax(0, 1fr); }
  .recipe-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Print: ingredients and steps only, on cream-free paper */
@media print {
  .recipe-no-print, .tracking-top, .recipe-badge, .recipe-servings, .recipe-ingredient-group input { display: none !important; }
  .recipe-print-only { display: block; }
  .recipes-page { background: #fff !important; color: #000; }
  .recipes-page .recipes-shell { width: 100%; gap: 14px; margin: 0; }
  .recipe-head { grid-template-columns: 1fr; }
  .recipe-cover { max-height: 220px; aspect-ratio: auto; box-shadow: none; border-radius: 8px; }
  .recipe-cover img { max-height: 220px; }
  .recipe-columns { grid-template-columns: 1fr; gap: 12px; }
  .recipe-ingredients, .recipe-steps, .recipe-facts li, .recipe-steps li { box-shadow: none; border: 1px solid #ccc; background: #fff; break-inside: avoid; }
  .recipe-ingredient-group li label { grid-template-columns: auto minmax(0, 1fr); min-height: 0; padding: 3px 0; }
  .recipe-ingredient-group li label::before { content: "☐"; margin-inline-end: 6px; }
  .recipe-step-number { background: #000; color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .recipe-print-footer { margin-top: 12px; color: #555; font-size: 12px; text-align: center; direction: ltr; }
  a { text-decoration: none; color: inherit; }
}
