/* ==========================================================================
   Recipe browse page — cuisine picker + recipe grid.

   Requires css/design-tokens.css.

   Mirrors the app's explore tab (home_tab.dart): a horizontal row of cuisine
   chips filtering a list of recipe cards, each card being the photo with a
   gradient scrim and the title over it.
   ========================================================================== */

body.recipes-page {
    background-color: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

.recipes-shell {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px 72px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.recipes-header {
    padding: 40px 0 24px;
    background: linear-gradient(180deg, var(--tile-green) 0%, var(--paper) 100%);
}

.recipes-header__inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

.recipes-header__kicker {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1rem;
    color: var(--turmeric-text);
}

.recipes-header__title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.8rem, 1.4rem + 2vw, 2.6rem);
    line-height: 1.14;
    color: var(--ink);
}

/* --------------------------------------------------------------------------
   Cuisine chips

   Scrolls horizontally rather than wrapping: with a dozen cuisines a wrapped
   row pushes the recipes themselves below the fold on a phone.
   -------------------------------------------------------------------------- */

.cuisine-row {
    display: flex;
    gap: 10px;
    margin: 0 0 28px;
    padding: 4px 0 12px;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.cuisine-row::-webkit-scrollbar { height: 4px; }
.cuisine-row::-webkit-scrollbar-thumb {
    background: var(--divider);
    border-radius: 2px;
}

.cuisine-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--divider);
    border-radius: 999px;
    background: #fff;
    color: var(--cardamom);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cuisine-chip:hover {
    background: var(--tile-green);
}

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

.cuisine-chip:focus-visible {
    outline: 3px solid var(--turmeric);
    outline-offset: 2px;
}

.cuisine-chip__img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--tile-green);
}

/* --------------------------------------------------------------------------
   Recipe grid
   -------------------------------------------------------------------------- */

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.recipe-card {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 210px;
    border-radius: var(--r-xl);
    background-color: var(--tile-green);
    /* Crop 20% off every side. These photos are shot wide, so `cover` alone
       left the dish small and dark in the middle of the card; scaling to 140%
       and keeping it centred trims an even border and fills the frame with
       food. The recipe page's own hero is composed differently and is left
       alone. */
    background-size: 140% auto;
    background-position: center center;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-raised);
}

.recipe-card__link {
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: 48px 18px 16px;
    /* Same scrim ramp the app uses instead of a backdrop blur: it keeps white
       text legible over any photo for effectively no cost. */
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.45) 45%,
        rgba(0, 0, 0, 0.80) 100%);
    color: #fff;
    text-decoration: none;
}

.recipe-card__link:hover,
.recipe-card__link:focus {
    color: #fff;
    text-decoration: none;
}

.recipe-card__link:focus-visible {
    outline: 3px solid var(--turmeric);
    outline-offset: -3px;
}

.recipe-card__body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.recipe-card__titles {
    min-width: 0;
}

.recipe-card__name {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.2;
    color: #fff;
    /* Long dish names truncate rather than pushing the cook time off the card. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-card__subtext {
    margin: 4px 0 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipe-card__time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    font-family: var(--font-data);
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
}

/* --------------------------------------------------------------------------
   States
   -------------------------------------------------------------------------- */

.recipes-state {
    padding: 56px 20px;
    text-align: center;
}

.recipes-state__title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--ink);
}

.recipes-state__body {
    margin: 0 0 20px;
    font-size: 0.95rem;
    color: var(--cement-grey);
}

.skeleton-card {
    min-height: 210px;
    border-radius: var(--r-xl);
    background: linear-gradient(90deg, var(--tile-green) 25%, #eef3ef 37%, var(--tile-green) 63%);
    background-size: 400% 100%;
    animation: recipes-shimmer 1.4s ease infinite;
}

@keyframes recipes-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-card { animation: none; }
    .recipe-card:hover { transform: none; }
}

.is-hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .recipes-header { padding: 28px 0 18px; }
    .recipes-header__inner { padding: 0 16px; }
    .recipes-shell { padding: 0 16px 56px; }

    .recipe-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .recipe-card,
    .skeleton-card { min-height: 180px; }
}
