/* ==========================================================================
   100MCQs Design System v2 — homepage / discovery / search layer (M2-A pilot)
   Builds on ds.css tokens. Scoped to html.ds. Loaded only by pilot pages.
   ========================================================================== */

html.ds .nav-toggle { padding: 0 14px !important; width: auto !important; gap: 8px; white-space: nowrap; }
html.ds .section-head h2 { letter-spacing: -.015em; color: var(--ink); }
html.ds .section-head h2::after { background: var(--gold) !important; }
html.ds .section-head p { color: var(--muted); }
html.ds .card { border: 1px solid var(--line) !important; border-radius: var(--r3) !important; box-shadow: var(--sh-1) !important; background: var(--card) !important; }
html.ds a.card:hover, html.ds .ds-subjcard:hover { transform: translateY(-2px); box-shadow: var(--sh-2) !important; border-color: var(--line-2) !important; }
html.ds .chip-free { background: var(--ok-tint) !important; color: var(--ok) !important; border-color: transparent !important; }
html.ds .chip { border-radius: var(--rp) !important; }
html.ds .card-head { display: flex; align-items: center; gap: 12px; }

/* ---------- Hero ---------------------------------------------------------- */
html.ds .hero-journey { background: radial-gradient(1200px 500px at 85% 20%, #1F3A63 0%, var(--navy) 55%) !important; position: relative; overflow: hidden; }
html.ds .hero-journey::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--band) repeat-x; background-size: 28px 6px; }
html.ds .hj-copy h1 { letter-spacing: -.02em; line-height: 1.12; }
html.ds .hj-copy h1 .accent { color: var(--gold); }
html.ds .hj-copy .lede { color: #D9E2EE; max-width: 52ch; }
html.ds .cta-row .btn-gold { background: var(--gold) !important; color: var(--navy) !important; border-radius: var(--rp) !important; box-shadow: 0 6px 18px rgba(226,169,59,.28); }
html.ds .cta-row .btn-on-navy { border-radius: var(--rp) !important; }

/* Class picker (hero + discovery jump bar) */
html.ds .ds-classpick { margin-top: 26px; }
html.ds .ds-cp-label { margin: 0 0 10px; font-size: var(--fs-0); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #F2D9A6; }
html.ds .ds-cp-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-width: 420px; }
html.ds .ds-cp-row a {
  display: grid; place-items: center; gap: 0; padding: 8px 0 9px; min-height: 58px; border-radius: 14px; text-decoration: none;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); color: #fff; transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
html.ds .ds-cp-row a:hover { background: rgba(255,255,255,.14); border-color: var(--gold); transform: translateY(-1px); }
html.ds .ds-cp-k { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; opacity: .78; }
html.ds .ds-cp-n { font-size: 1.45rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* light variant on discovery: sticky jump bar */
html.ds .ds-jumpwrap { position: sticky; top: 64px; z-index: 30; background: rgba(247,245,240,.95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
html.ds .ds-classpick-bar { margin: 0; padding: 10px 0; }
html.ds .ds-classpick-bar .ds-cp-label { color: var(--muted); margin-bottom: 8px; }
html.ds .ds-classpick-bar .ds-cp-row { max-width: 520px; }
html.ds .ds-classpick-bar .ds-cp-row a { background: var(--card); border-color: var(--line); color: var(--ink); min-height: 52px; }
html.ds .ds-classpick-bar .ds-cp-row a:hover { border-color: var(--teal); background: var(--teal-tint); }
html.ds .ds-classpick-bar .ds-cp-k { color: var(--muted); opacity: 1; }
@media (max-width: 1023px) { html.ds .ds-jumpwrap { top: 0; } html.ds .ds-classpick-bar .ds-cp-label { display: none; } html.ds .ds-classpick-bar .ds-cp-row a { min-height: 46px; } }
html.ds section[aria-labelledby^="disc-c"], html.ds #disc-c6 { scroll-margin-top: 150px; }
html.ds h2[id^="disc-c"] { scroll-margin-top: 150px; }

/* Trust strip */
html.ds .ds-trust { background: var(--card); border-bottom: 1px solid var(--line); }
html.ds .ds-trust ul { list-style: none; margin: 0; padding: 18px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
html.ds .ds-trust li { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-1); color: var(--ink-2); line-height: 1.45; }
html.ds .ds-trust li .ds-ic { width: 22px; height: 22px; color: var(--teal); margin-top: 1px; }
html.ds .ds-trust b { color: var(--ink); }
@media (max-width: 900px) { html.ds .ds-trust ul { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { html.ds .ds-trust ul { grid-template-columns: 1fr; gap: 10px; padding: 14px 0; } }

/* Search strip */
html.ds .search-strip { border-radius: var(--r3) !important; border: 1px solid var(--line) !important; box-shadow: var(--sh-1) !important; }
html.ds .search-strip input { border-radius: var(--rp) !important; border-color: var(--line-2) !important; min-height: 48px; padding-inline: 18px !important; }
html.ds .search-strip button { border-radius: var(--rp) !important; background: var(--teal) !important; min-height: 48px; padding-inline: 22px !important; }

/* Class cards */
html.ds .ds-classh { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 8px !important; }
html.ds .ds-cls-k { font-size: var(--fs-1); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
html.ds .ds-cls-n { font-size: 2.3rem; font-weight: 800; line-height: 1; color: var(--navy); letter-spacing: -.03em; }
html.ds .ds-subjrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
html.ds a.card .foot { color: var(--teal-ink) !important; font-weight: 700; }

/* Four resources: numbered steps */
html.ds .ds-step { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--teal-tint); color: var(--teal-ink); flex: none; }
html.ds .ds-step .ds-ic { width: 24px; height: 24px; }
html.ds .ds-step b { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .72rem; display: grid; place-items: center; border: 2px solid var(--card); }
html.ds .ds-how .grid { grid-template-columns: repeat(4, 1fr) !important; }
@media (max-width: 900px) { html.ds .ds-how .grid { grid-template-columns: 1fr 1fr !important; } }
@media (max-width: 520px) { html.ds .ds-how .grid { grid-template-columns: 1fr !important; gap: 10px !important; } html.ds .ds-how .card { padding: 14px 16px !important; } }

/* Free / Pro */
html.ds .ds-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
html.ds .ds-plan { border-radius: var(--r3); padding: 22px 22px 18px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--sh-1); }
html.ds .ds-plan-free { border-top: 4px solid var(--ok); }
html.ds .ds-plan-pro { border-top: 4px solid var(--gold); background: linear-gradient(180deg, #FFFCF5, #FFF8EA); border-color: #EFDDB6; }
html.ds .ds-plan-k { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 700; color: var(--ink-2); }
html.ds .ds-plan-k .ds-badge { font-size: .8rem; padding: 4px 10px; }
html.ds .ds-price { margin: 0 0 10px; color: var(--gold-ink); }
html.ds .ds-price strong { font-size: 2rem; letter-spacing: -.02em; color: var(--navy); }
html.ds .ds-price span { font-weight: 600; }
html.ds .ds-ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
html.ds .ds-ticks li { position: relative; padding-left: 28px; line-height: 1.55; color: var(--ink-2); }
html.ds .ds-ticks li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2317703F' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center/12px no-repeat; }
html.ds .ds-ticks-plan li::before { background: #F6E7C6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A5A0E' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='6.5'/%3E%3Cpath d='M12 9v3.3l2 1.3'/%3E%3C/svg%3E") center/13px no-repeat; }
@media (max-width: 760px) { html.ds .ds-plans { grid-template-columns: 1fr; } }

/* Discovery subject cards: identity, compact on phones */
html.ds .ds-subjcard { border-top: 3px solid var(--subj) !important; transition: transform var(--ease), box-shadow var(--ease); }
html.ds .ds-subjcard .card-head h3 { line-height: 1.25; }
html.ds .ds-subjcard .topics { background: var(--paper) !important; border: 0 !important; border-radius: 10px !important; }
html.ds .ds-subjcard .topics-label { color: var(--subj) !important; }
html.ds .ds-subjcard .card-actions a { color: var(--teal-ink) !important; font-weight: 700; }
@media (max-width: 760px) {
  html.ds .ds-subjcard { padding: 14px 14px 12px !important; }
  html.ds .ds-subjcard .card-head { gap: 10px; margin-bottom: 6px; }
  html.ds .ds-subjcard .card-head h3 { font-size: 1rem !important; }
  html.ds .ds-subjcard .badges { margin: 0 0 6px !important; }
  html.ds .ds-subjcard .topics { padding: 8px 10px !important; font-size: .82rem !important; margin: 0 0 8px !important; }
  html.ds .ds-subjcard .topics-label { display: none; }
  html.ds .grid.grid-3 { gap: 10px !important; }
  html.ds .hero-journey .hj-media img { max-height: 210px; object-fit: cover; object-position: 70% 60%; }
  html.ds .ds-cp-row { max-width: none; }
}

html.ds .ds-subjcard .card-actions { margin-top: 4px !important; padding-top: 0 !important; }
@media (max-width: 760px) { html.ds .ds-subjcard .card-actions a { padding: 6px 0; display: inline-block; } }

/* ---------- Search (results are created by JS, so these must be global; the page's scoped
   .sr-* rules never reached them — results rendered as plain underlined links) --------- */
html.ds #results { display: grid; gap: 10px; margin-top: 10px; }
html.ds .sr-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--sh-1); transition: border-color var(--ease), transform var(--ease); }
html.ds .sr-card:hover { border-color: var(--teal); transform: translateY(-1px); }
html.ds .sr-title { font-weight: 700; font-size: var(--fs-3); overflow-wrap: anywhere; color: var(--ink); }
html.ds .sr-meta { color: var(--muted); font-size: var(--fs-0); line-height: 1.45; }
html.ds .sr-kind { display: inline-block; background: var(--teal-tint); color: var(--teal-ink); border-radius: var(--rp); padding: 1px 9px; font-size: .72rem; font-weight: 700; margin-right: 6px; letter-spacing: .02em; }
html.ds #search-form, html.ds .search-panel { border-radius: var(--r3) !important; border: 1px solid var(--line) !important; box-shadow: var(--sh-1) !important; background: var(--card) !important; }
html.ds #q { min-height: 50px; border-radius: var(--rp) !important; padding-inline: 18px !important; font-size: var(--fs-3) !important; }
html.ds #search-form select { min-height: 44px; border-radius: 12px !important; }
html.ds #result-count { color: var(--muted); font-weight: 600; }
html.ds .sr-card > * { margin: 0 !important; }
html.ds .sr-meta:empty { display: none; }
@media (max-width: 640px) {
  /* filters side by side so results start sooner on phones */
  html.ds .search-form .sf-filters { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px 10px !important; }
  html.ds .search-form .sf-filters label { font-size: var(--fs-0); margin-bottom: 4px; display: block; }
  html.ds .search-form .sf-filters select { width: 100%; font-size: .9rem; }
  html.ds .search-form .sf-clear { align-self: end; }
  html.ds .search-form .sf-clear button { width: 100%; min-height: 44px; border-radius: 12px; font-size: .85rem; }
}
@media (min-width: 761px) and (max-width: 1023px) {
  html.ds .hero-journey .hj-media img { max-height: 300px; width: 100%; object-fit: cover; object-position: 70% 55%; }
}

/* ---------- M2-B hero: phones/tablets — artwork becomes a soft backdrop, not a 300px block ---------- */
@media (max-width: 1023px) {
  html.ds .hero-journey { position: relative; display: block; min-height: 0; }
  html.ds .hero-journey .hj-media { position: absolute !important; inset: 0; height: 100% !important; order: 0; z-index: 0; }
  html.ds .hero-journey .hj-media picture { height: 100%; }
  html.ds .hero-journey .hj-media img { width: 100%; height: 100% !important; max-height: none !important; object-fit: cover; object-position: 80% 70%; opacity: .32; }
  html.ds .hero-journey::before { content: ""; position: absolute; inset: 0; height: auto; z-index: 1;
    background: linear-gradient(180deg, rgba(19,35,59,.55) 0%, rgba(19,35,59,.86) 42%, rgba(19,35,59,.94) 100%); }
  html.ds .hero-journey .hj-wrap { position: relative; z-index: 2; }
  html.ds .hero-journey .hj-copy { padding: 28px 0 30px; }
  html.ds .hj-copy h1 { font-size: clamp(1.75rem, 1.2rem + 3.2vw, 2.4rem); }
  html.ds .hj-copy .lede { font-size: 1rem; line-height: 1.6; }
  html.ds .hero-journey .ds-classpick { margin: 20px 0 18px; }
  html.ds .hero-journey .cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
  html.ds .hero-journey .cta-row .btn-on-navy { background: transparent !important; border: 0 !important; padding-inline: 4px !important; text-decoration: underline; text-underline-offset: 4px; }
}
/* desktop: picker sits under the lede, buttons after it */
html.ds .hero-journey .ds-classpick { margin: 22px 0 22px; }

/* ---------- M2-B final refinement: phone hero — the journey artwork is shown crisp at the top of
   the hero (no artwork behind the text, so no ghost labels under the copy) ---------------------- */
@media (max-width: 760px) {
  html.ds .hero-journey::before { content: none; }
  html.ds .hero-journey .hj-media { position: relative !important; inset: auto; height: 214px !important; z-index: 0; overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 66%, transparent 100%);
            mask-image: linear-gradient(180deg, #000 0%, #000 66%, transparent 100%); }
  html.ds .hero-journey .hj-media picture { display: block; height: 100%; }
  html.ds .hero-journey .hj-media img {
    width: 100%; height: 100% !important; object-fit: cover; object-position: 100% 62%; opacity: 1; transform: scale(1.22); transform-origin: 92% 12%;
  }
  html.ds .hero-journey .hj-copy { padding: 0 0 30px; margin-top: -22px; }
  html.ds .hj-copy h1 { text-shadow: 0 2px 18px rgba(19,35,59,.85); }
}

/* ---------- M2-B final refinement: Discovery on phones — compact subject rows ----------------
   Same content and links; the card becomes an icon + title row with badges, topics and actions
   beneath, so a class fits in far less scrolling. */
@media (max-width: 760px) {
  html.ds .ds-subjcard {
    display: grid !important; grid-template-columns: 40px 1fr; column-gap: 12px; row-gap: 4px; align-items: start;
    padding: 12px 14px 10px !important; border-top-width: 0 !important; border-inline-start: 4px solid var(--subj) !important;
  }
  html.ds .ds-subjcard:hover { transform: none; }
  html.ds .ds-subjcard .card-head { display: contents; }
  html.ds .ds-subjcard .card-head .ds-tile { grid-column: 1; grid-row: 1 / span 3; width: 40px; height: 40px; border-radius: 11px; }
  html.ds .ds-subjcard .card-head .ds-tile .ds-ic { width: 21px; height: 21px; }
  html.ds .ds-subjcard .card-head h3 { grid-column: 2; margin: 1px 0 0 !important; font-size: 1rem !important; }
  html.ds .ds-subjcard .badges { grid-column: 2; margin: 0 !important; gap: 5px !important; }
  html.ds .ds-subjcard .badges .chip { font-size: .72rem !important; padding: 2px 8px !important; }
  html.ds .ds-subjcard .topics {
    grid-column: 2; background: none !important; padding: 0 !important; margin: 0 !important;
    font-size: .8rem !important; color: var(--muted) !important; line-height: 1.4;
  }
  html.ds .ds-subjcard .card-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 2px !important; }
  html.ds .ds-subjcard .card-actions a { min-height: 40px; display: inline-flex !important; align-items: center; padding: 0 !important; }
  html.ds .ds-subjcard > p:not(.topics), html.ds .ds-subjcard .card-desc { grid-column: 1 / -1; margin: 2px 0 0 !important; font-size: .85rem; }
}

/* ---------- M2-B final: desktop hero — the journey artwork is feathered into the hero background
   (no visible image rectangle); same image, CSS mask only ---------- */
@media (min-width: 1024px) {
  html.ds .hero-journey .hj-media img {
    -webkit-mask-image: radial-gradient(ellipse 50% 56% at 66% 50%, #000 52%, rgba(0,0,0,.55) 72%, transparent 96%);
            mask-image: radial-gradient(ellipse 50% 56% at 66% 50%, #000 52%, rgba(0,0,0,.55) 72%, transparent 96%);
  }
}

/* tablets (761–1023 px): desktop-style composition — copy left, crisp feathered artwork right
   (replaces the faded backdrop behind the copy) */
@media (min-width: 761px) and (max-width: 1023px) {
  html.ds .hero-journey::before { content: none; }
  html.ds .hero-journey .hj-media { position: absolute !important; inset: 0 0 0 auto; width: 56%; height: 100% !important; z-index: 0; }
  html.ds .hero-journey .hj-media img {
    opacity: 1; object-fit: cover; object-position: 88% 55%;
    -webkit-mask-image: radial-gradient(ellipse 62% 60% at 62% 52%, #000 50%, rgba(0,0,0,.5) 72%, transparent 96%);
            mask-image: radial-gradient(ellipse 62% 60% at 62% 52%, #000 50%, rgba(0,0,0,.5) 72%, transparent 96%);
  }
  html.ds .hero-journey .hj-copy { max-width: 52%; }
  html.ds .hj-copy h1 { font-size: 2rem; }
}
@media (min-width: 761px) and (max-width: 899px) {
  html.ds .hero-journey .hj-media { width: 50%; }
  html.ds .hero-journey .hj-media img { object-position: 96% 55%; }
}

/* Discovery on phones: one class at a time (shell.js); the chosen class is marked in the picker */
@media (max-width: 760px) {
  html.ds.ds-oneclass section.ds-class-off { display: none; }
  html.ds .ds-classpick-bar a.is-current { background: var(--navy) !important; border-color: var(--navy) !important; color: #fff !important; }
  html.ds .ds-classpick-bar a.is-current .ds-cp-k { color: #C6D1E0 !important; }
}

/* the language filter hides cards with an inline display:none — keep that winning over the compact-row grid */
html.ds .ds-subjcard[style*="display: none"], html.ds .ds-subjcard[style*="display:none"] { display: none !important; }
/* one-class mode: the language filter applies to Class 6 (the only class with Sindhi-medium books) */
@media (max-width: 760px) { html.ds.ds-oneclass.ds-notc6 .filter-row, html.ds.ds-oneclass.ds-notc6 #filter-note { display: none; } }
