/*
 * Home (D8, decision 65; Nadav picked B, story cards, decision 66): greeting + status, the top-4 lead deck,
 * a last card to all leads. Loads after skin.css. Copy: e4, docs/content-samples/d8-home-copy.md. Demo: screens/home.html.
 * Swipe: the deck runs left = next on phone, like the post carousel (approved) and Instagram, with story segments above it.
 * Desktop ≥ 960 shows the deck as one row in reading order (RTL), with the last card as a slim fifth column.
 */

.app.is-home .pane-detail { display: none; }
@media (min-width: 960px) {
  .app.is-home .pane-list { grid-column: 2 / -1; border-inline-end: 0; }
  .app.is-home .view { max-width: 1180px; }
}

/* greeting + one status line */
.h-hi { display: grid; gap: 4px; margin-bottom: 14px; }
.h-hi h1 { margin: 0; font-size: var(--t-2xl); font-weight: 900; line-height: 1.2; }
.h-status { margin: 0; color: var(--muted); font-size: var(--t-sm); line-height: 1.5; }
.h-status a { position: relative; color: var(--mint); font-weight: 700; text-decoration: none; }
.h-status a::after { content: ""; position: absolute; inset: -12px -4px; }   /* 20 px line → 44 px target */
.h-status .warn { color: var(--warn); }

/* section header over the deck */
.h-sec { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.h-sec h2 { margin: 0; font-size: var(--t-lg); font-weight: 800; }
.h-more { position: relative; flex: none; color: var(--mint); font-size: var(--t-sm); font-weight: 700; text-decoration: none; white-space: nowrap; }
.h-more::after { content: ""; position: absolute; inset: -12px -6px; }

/* story segments: where you are in the deck (filled up to the current card) */
.h-segs { display: flex; gap: 4px; margin-bottom: 12px; direction: ltr; }
.h-segs i { flex: 1; height: 3px; border-radius: 2px; background: var(--line-2); }
.h-segs i.on { background: var(--mint); }

/* the deck: full-bleed scroller on phone, left = next; the next card peeks 20 px */
.deck { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
  direction: ltr; margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter) 8px; scroll-padding-inline: var(--gutter); }
.deck::-webkit-scrollbar { display: none; }
.deck > * { direction: rtl; scroll-snap-align: start; flex: 0 0 calc(100% - 20px); min-height: min(60vh, 500px); }

/* one lead card: the whole card is the link to the lead */
.hcard { position: relative; display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 22px 20px 20px; border-radius: 28px; overflow: hidden;
  background: radial-gradient(130% 75% at 100% 0%, var(--tint, transparent), transparent 62%), var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--fg); text-decoration: none; transition: transform .15s var(--ease-out); }
.hcard { isolation: isolate; }   /* the watermark paints behind the content, above the card fill */
.hcard::after { content: attr(data-e); position: absolute; inset-inline-start: -14px; bottom: -26px; font-size: 150px; line-height: 1; opacity: .09; pointer-events: none; transform: rotate(-12deg); z-index: -1; }
.hcard:active { transform: scale(.98); transition-delay: 90ms; }
.hcard.hot { box-shadow: inset 0 0 0 1.5px var(--mint-line); }
.hc-top { display: flex; align-items: center; gap: 12px; }
.hc-meta { display: grid; gap: 6px; min-width: 0; justify-items: start; }
.hc-time { color: var(--muted); font-size: var(--t-xs); }
.hcard .chip-e { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcard .ring-score { width: 76px; height: 76px; }
.hcard .ring-score b { font-size: 26px; }
.hc-title { margin: 0; font-size: var(--t-2xl); font-weight: 900; line-height: 1.25; text-wrap: pretty; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.hc-angle { margin: 0; padding: 14px 16px; border-radius: 18px; background: var(--scrim); box-shadow: inset 0 0 0 1px var(--mint-line);
  color: var(--fg); font-size: var(--t-md); font-weight: 600; line-height: 1.5; }
.hc-angle > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }   /* clamp the text, not the padded box */
.hc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 4px; }
.hc-src { min-width: 0; color: var(--muted); font-size: var(--t-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-go { flex: none; padding: 10px 16px; border-radius: 999px; background: var(--mint); color: var(--mint-ink); font-size: var(--t-sm); font-weight: 800; }

/* category tint (top corner glow) */
[data-cat="storm"] { --tint: rgba(255, 126, 112, .22); }
[data-cat="comeback"] { --tint: rgba(147, 187, 255, .22); }
[data-cat="opening"], [data-cat="event"] { --tint: rgba(100, 247, 203, .2); }
[data-cat="prices"], [data-cat="closing"] { --tint: rgba(255, 200, 97, .2); }
[data-cat="business"], [data-cat="chefs"], [data-cat="celeb"] { --tint: rgba(201, 174, 255, .22); }
[data-cat="health"] { --tint: rgba(255, 126, 112, .16); }

/* memorial: calm (no tint, no watermark, no chili, no motion), as in the list */
.hcard.calm { --tint: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.hcard.calm::after { display: none; }
.hcard.calm .ring-score .val { stroke: var(--fg-2); animation: none; }
.hcard.calm:active { transform: none; }

/* the last card: to all leads */
.hcard.all { justify-content: center; align-items: center; text-align: center; background: var(--mint-soft); }   /* outline and gap as on every card (as picked) */
.hcard.all::after { display: none; }
.all-go { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--mint-ink); font-size: 28px; font-weight: 900; box-shadow: var(--shadow-fab); }
.hcard.all b { font-size: var(--t-xl); font-weight: 900; }
.hcard.all > span:not(.all-go) { color: var(--fg-2); font-size: var(--t-sm); }

/* fewer than 4 leads: news below */
.h-news { margin-top: 28px; }
.h-news ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.h-news li > a { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 14px; border-radius: 18px; background: var(--surface); color: var(--fg); text-decoration: none; }
.h-news .s-ic { width: 40px; height: 40px; }
.h-news b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: var(--t-md); font-weight: 700; line-height: 1.4; }
.h-news small { display: block; color: var(--muted); font-size: var(--t-xs); margin-top: 2px; }

/* loading: the deck's shape, shimmering, with bobbing chilies (no text) */
.hcard.ghost { pointer-events: none; }
.hcard.ghost::after { display: none; }
.hcard.ghost .skel i { height: 14px; }
.hcard.ghost .skel i:first-child { height: 20px; }

/* desktop: one row, reading order */
@media (min-width: 960px) {
  .h-segs { display: none; }
  .deck { direction: rtl; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 168px; overflow: visible; margin: 0; padding: 0; gap: 16px; }
  .deck > * { min-height: 470px; }
  .hc-title { font-size: var(--t-xl); }
  .hcard .ring-score { width: 60px; height: 60px; }
  .hcard .ring-score b { font-size: 21px; }
  .hc-foot { flex-direction: column-reverse; align-items: stretch; text-align: center; }
}

@media (prefers-reduced-motion: reduce) { .hcard:active { transform: none; } }

/* ops alerts (Nadav only): one row per open problem, under the greeting, until it's fixed. Calm but unmissable:
   a soft fill with an accent on the start edge (right, in RTL). No dismiss: the row goes when the problem does.
   Markup: .ops-list > .ops (or .ops.bad for a hard failure) > p (b = what's wrong, then since when) + optional a.btn.sm (what to do). */
.ops-list { display: grid; gap: 8px; margin: 0 0 16px; }
.ops { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 12px 14px; border-radius: 14px;
  background: var(--warn-soft); border-inline-start: 3px solid var(--warn); }
.ops p { margin: 0; font-size: var(--t-sm); line-height: 1.5; color: var(--fg-2); }
.ops b { color: var(--warn); font-weight: 800; }
.ops .btn.sm { white-space: nowrap; }
.ops.bad { background: var(--bad-soft); border-inline-start-color: var(--bad); }
.ops.bad b { color: var(--bad); }
