/* =====================================================================
   New home-page sections, used on every screen size:
   "Popular right now" (auto-sliding row) and "Something for everyone"
   (random food grid). Also used by premium.html.
   Phones get compact cards here; wide screens use the cards from
   css/desktop.css, with the section layout below.
   ===================================================================== */

:root {
    --hm-yellow: #F6D401;
    --hm-yellow-dark: #E2C200;
    --hm-yellow-soft: #FFF7C2;
    --hm-ink: #1A1A1A;
    --hm-ink-2: #3D3D3D;
    --hm-muted: #8A8A8A;
    --hm-line: #ECEAE4;
    --hm-cream: #F7F4EC;
}

.hm-section { padding: 22px 0 8px; }
.hm-section[hidden] { display: none; }
.hm-wrap { padding: 0 16px; }
.hm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.hm-head-center { justify-content: center; text-align: center; }
.hm-eyebrow { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #A88F00; }
.hm-eyebrow.light { color: var(--hm-yellow); }
.hm-title { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.15; color: var(--hm-ink); }
.hm-head-actions { display: flex; align-items: center; gap: 10px; }
.hm-link { flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--hm-ink); text-decoration: none; white-space: nowrap; }
.hm-link:hover { text-decoration: underline; }
.hm-shuffle { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--hm-line); border-radius: 999px; background: #fff; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--hm-ink); cursor: pointer; }
.hm-shuffle:hover { border-color: var(--hm-ink); }
.hm-shuffle.spin svg { animation: hm-spin 0.5s ease; }

/* Auto-sliding row (moved by js/home.js; swipe/scroll by hand also works) */
.hm-track { display: flex; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; padding: 4px 0 14px; }
.hm-track::-webkit-scrollbar { display: none; }
.hm-track:focus-visible { outline: 2px solid var(--hm-ink); outline-offset: -2px; }
.hm-track-inner { display: flex; gap: 12px; padding-left: 12px; }
.hm-track-inner:first-child { padding-left: 16px; }
/* Fixed width: without min-width: 0 a card grows to fit its one-line description */
.hm-track .dk-card { flex: 0 0 158px; width: 158px; min-width: 0; }
.hm-track .dk-card-body { min-width: 0; }

.hm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hm-loading { grid-column: 1 / -1; padding: 40px 16px; text-align: center; font-size: 14px; color: var(--hm-muted); }
.hm-spinner { display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; border: 2px solid var(--hm-line); border-top-color: var(--hm-ink); border-radius: 50%; animation: hm-spin 0.8s linear infinite; }

@keyframes hm-spin { to { transform: rotate(360deg); } }

/* ---------- Phone cards (same design as the menu, sized for phones) ---------- */
@media (max-width: 768px) {
    .hm-section .dk-card,
    .pm-page .dk-card, .menu-page-items .dk-card { position: relative; display: flex; flex-direction: column; padding: 6px 6px 10px; border: 1px solid var(--hm-line); border-radius: 14px; background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .hm-section .dk-card:active, .pm-page .dk-card:active, .menu-page-items .dk-card:active { transform: scale(0.98); }
    .hm-section .dk-card.unavailable .dk-card-media img, .pm-page .dk-card.unavailable .dk-card-media img, .menu-page-items .dk-card.unavailable .dk-card-media img { filter: grayscale(0.85); opacity: 0.65; }
    .hm-section .dk-card-media, .pm-page .dk-card-media, .menu-page-items .dk-card-media { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--hm-cream); }
    .hm-section .dk-card-media img, .pm-page .dk-card-media img, .menu-page-items .dk-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .hm-section .dk-noimg, .pm-page .dk-noimg, .menu-page-items .dk-noimg { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #CFC9B8; }
    .hm-section .dk-badge, .pm-page .dk-badge, .menu-page-items .dk-badge { position: absolute; top: 6px; left: 6px; padding: 3px 8px; border-radius: 999px; background: var(--hm-yellow); color: var(--hm-ink); font-size: 9px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
    .hm-section .dk-badge.new, .pm-page .dk-badge.new, .menu-page-items .dk-badge.new { background: var(--hm-ink); color: var(--hm-yellow); }
    .hm-section .dk-badge.off, .pm-page .dk-badge.off, .menu-page-items .dk-badge.off { background: #FDECEC; color: #C62828; }
    .hm-section .dk-heart, .pm-page .dk-heart, .menu-page-items .dk-heart { position: absolute; top: 6px; right: 6px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--hm-ink); }
    .hm-section .dk-heart.on svg, .pm-page .dk-heart.on svg, .menu-page-items .dk-heart.on svg { fill: var(--hm-yellow); stroke: var(--hm-yellow-dark); }
    .hm-section .dk-card-body, .pm-page .dk-card-body, .menu-page-items .dk-card-body { display: flex; flex: 1; flex-direction: column; padding: 8px 2px 0; }
    .hm-section .dk-card-body h3, .pm-page .dk-card-body h3, .menu-page-items .dk-card-body h3 { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.3; color: var(--hm-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .hm-section .dk-card-desc, .pm-page .dk-card-desc, .menu-page-items .dk-card-desc { display: none; }
    .hm-section .dk-meta, .pm-page .dk-meta, .menu-page-items .dk-meta { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 4px; font-size: 10.5px; color: var(--hm-muted); }
    .hm-section .dk-meta span, .pm-page .dk-meta span, .menu-page-items .dk-meta span { display: inline-flex; align-items: center; gap: 3px; }
    .hm-section .dk-meta b, .pm-page .dk-meta b, .menu-page-items .dk-meta b { color: var(--hm-ink); }
    .hm-section .dk-meta .star, .pm-page .dk-meta .star, .menu-page-items .dk-meta .star { color: var(--hm-yellow-dark); }
    .hm-section .dk-card-foot, .pm-page .dk-card-foot, .menu-page-items .dk-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
    .hm-section .dk-price, .pm-page .dk-price, .menu-page-items .dk-price { font-size: 14px; font-weight: 800; color: var(--hm-ink); }
    .hm-section .dk-price small, .pm-page .dk-price small, .menu-page-items .dk-price small { margin-right: 2px; font-size: 9.5px; font-weight: 700; color: var(--hm-muted); }
    .hm-section .dk-add, .pm-page .dk-add, .menu-page-items .dk-add { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: none; border-radius: 50%; background: var(--hm-yellow); color: var(--hm-ink); }
    .hm-section .dk-add.done, .pm-page .dk-add.done, .menu-page-items .dk-add.done { background: #2E7D32; color: #fff; }
    .hm-section .dk-add:disabled, .pm-page .dk-add:disabled, .menu-page-items .dk-add:disabled { background: var(--hm-line); color: var(--hm-muted); }
}

/* ---------- Wide screens: section layout (cards come from desktop.css) ---------- */
@media (min-width: 769px) {
    .hm-section { padding: 64px 0 24px; font-family: 'Plus Jakarta Sans', Arial, sans-serif; }
    .hm-all { padding-bottom: 72px; }
    .hm-wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
    .hm-head { margin-bottom: 26px; }
    .hm-eyebrow { font-size: 12px; }
    .hm-title { font-family: 'Alfa Slab One', Georgia, serif; font-size: 34px; font-weight: 400; letter-spacing: 0.005em; }
    .hm-link { font-size: 14px; }
    .hm-shuffle { height: 40px; padding: 0 16px; font-size: 13px; }
    .hm-track { padding: 6px 0 24px; }
    .hm-track-inner { gap: 18px; padding-left: 18px; }
    .hm-track-inner:first-child { padding-left: max(32px, calc((100vw - 1176px) / 2)); }
    /* Same width as one column of the food grid below (4 / 3 / 2 columns) */
    .hm-track { --hm-card: calc((min(100vw - 16px, 1240px) - 64px - 54px) / 4); }
    .hm-track .dk-card { flex: 0 0 var(--hm-card); width: var(--hm-card); }
    .hm-track-inner { align-items: stretch; }
    .hm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
}
@media (min-width: 769px) and (max-width: 1180px) {
    .hm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hm-track { --hm-card: calc((100vw - 16px - 64px - 36px) / 3); }
}
@media (min-width: 769px) and (max-width: 1000px) {
    .hm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hm-track { --hm-card: calc((100vw - 16px - 64px - 18px) / 2); }
}

@media (prefers-reduced-motion: reduce) {
    .hm-shuffle.spin svg { animation: none; }
}

/* Popular row: grab and drag with the mouse (js/home.js) */
@media (hover: hover) and (pointer: fine) {
    .hm-track { cursor: grab; }
    .hm-track.dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
    .hm-track.dragging .dk-card { pointer-events: none; }
}
.hm-track img { -webkit-user-drag: none; user-select: none; }
