/* ── Sanad Academy — Design improvements 2026-10 ────────────────────────────
   Layered on top of academy.css. Targets 6 areas:
   1. Homepage hero hierarchy
   2. Consistent programme cards
   3. Search/filter usability
   4. Programme detail layout
   5. Responsive mobile/RTL typography
   6. Loading/error state UI
   ─────────────────────────────────────────────────────────────────────────── */

/* ── 1. Homepage hero hierarchy ─────────────────────────────────────────── */

/* Larger h1 scale and breathing room on the home hero */
.hero.hhome h1 {
  font-size: clamp(28px, 5.5vw, 48px);
  margin-bottom: 16px;
  letter-spacing: -.01em;
}
.hero.hhome > .wrap > p {
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.6;
  max-width: 560px;
}

/* More space under kicker on home */
.hero.hhome .kicker {
  margin-bottom: 14px;
}

/* Next-start block: tighten on small viewports */
@media (max-width: 500px) {
  .nextstart { padding: 12px; gap: 10px; }
  .nextstart .nsi { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; }
  .nextstart b { font-size: 15px; }
  .nextstart .nst > span { font-size: 13px; }
}

/* Chips: prevent 3-column cramping below 400px */
@media (max-width: 400px) {
  .hero .chips { gap: 7px; }
  .hero .chips span { padding: 12px 6px 10px; min-height: 86px; }
  .hero .chips b { font-size: 12px; min-height: 30px; }
  .hero .chips i { width: 32px; height: 32px; }
}

/* Hero CTA: stack columns on very narrow screens */
@media (max-width: 360px) {
  .hero .hcta { grid-template-columns: 1fr; }
}

/* ── 2. Consistent programme cards ──────────────────────────────────────── */

/* Card thumbnail: fixed 3:4 aspect ratio, cover-fill image */
.card .thumb {
  display: block;
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--soft);
  overflow: hidden;
}
.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
@media (hover: hover) {
  .card .thumb:not([data-v]):hover img { transform: scale(1.03); }
}

/* Tag overlay: pinned to the bottom of the thumbnail */
.card .thumb .tag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 12px 10px;
  background: linear-gradient(transparent, rgba(11,42,74,.65));
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
}

/* Play affordance: centred overlay, shown on hover for teasable thumbs */
.card .thumb .play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11,42,74,.28);
  opacity: 0;
  transition: opacity .2s ease;
}
.card .thumb .play svg {
  width: 52px;
  height: 52px;
  fill: #fff;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.45));
}
.card .thumb[data-v]:hover .play,
.card .thumb[data-v]:focus-within .play { opacity: 1; }

/* Share button: absolute top-right corner of the card */
.card { position: relative; }
.card > .shbtn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  box-shadow: 0 2px 6px rgba(11,42,74,.14);
  transition: background .15s;
}
[dir=rtl] .card > .shbtn { right: auto; left: 10px; }
@media (hover: hover) { .card > .shbtn:hover { background: rgba(255,255,255,1); } }

/* Card body: push buttons to the bottom consistently */
.card .body {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.card .body .btns { margin-top: auto; padding-top: 12px; }
.card .summary { flex: 1; }

/* Grid: equal-height rows on desktop */
@media (min-width: 640px) {
  .grid { grid-auto-rows: 1fr; }
  .grid > .card { height: 100%; }
}

/* Rail scrollable row: consistent min-height */
.rail > .card { min-height: 420px; }

/* Fact chips on card: keep uniform width */
.fchips { display: flex; gap: 6px; flex-wrap: wrap; }
.fchips span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--soft);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}
.fchips svg { flex-shrink: 0; color: var(--teal); }

/* ── 3. Search/filter usability ─────────────────────────────────────────── */

/* Focus ring on the search box */
.search .in:focus-within {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(23,162,160,.15);
}

/* Filters: show at all times (not just on .open), but subtly */
.search .flt {
  display: flex !important;
  gap: 8px;
  margin-top: 8px;
}
.search .flt select {
  min-height: 42px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 0 10px;
  color: var(--ink);
  font-family: inherit;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  transition: border-color .15s;
}
.search .flt select:focus { outline: none; border-color: var(--teal); }

/* Enable the language filter (was hidden with !important) */
#flang { display: block !important; }

/* Mobile: stack filters vertically */
@media (max-width: 520px) {
  .search .flt { flex-direction: column; }
}

/* Search results: sticky group headers */
.search .res .grp {
  position: sticky;
  top: 0;
  background: var(--soft);
  z-index: 1;
}

/* No-results message alignment */
.search .res .none {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  font-size: 15px;
}

/* ── 4. Programme detail layout ─────────────────────────────────────────── */

/* Sub-hero (category/programme pages): tighten kicker size */
.hero:not(.hhome) .kicker { font-size: 11px; letter-spacing: .08em; }

/* Larger title on detail hero */
.hero:not(.hhome) h1 { font-size: clamp(24px, 4.5vw, 40px); line-height: 1.2; }

/* Audience badge: pill that pops in the dark hero */
.hero .aud {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,.2);
}

/* CTA row in detail hero: wrap gracefully */
.hero .cta { flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* Facts grid: more breathing room */
.facts { margin: 18px 0; gap: 10px; }
.facts div {
  border-radius: 14px;
  padding: 12px 8px;
}
.facts b { font-size: 20px; line-height: 1.1; }

/* On mobile, switch to 2×2 facts layout */
@media (max-width: 480px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
}

/* Week blocks: consistent spacing */
.week { margin-bottom: 12px; }
.week + .week { margin-top: 0; }

/* ── 5. Responsive mobile/RTL typography and spacing ────────────────────── */

@media (max-width: 480px) {
  body { font-size: 16px; }
  h2 { font-size: clamp(20px, 5.5vw, 27px); }
  h3 { font-size: 17px; }
  .hero { padding: 30px 0 24px; }
  section { padding: 30px 0; }
  .wrap { padding: 0 16px; }
  .card .body { padding: 14px; }
  .eyebrow { font-size: 12px; margin-bottom: 6px; }
  .btn { min-height: 46px; font-size: 15px; }
  .catcard { min-height: 130px; padding: 14px; }
  .catcard b { font-size: 14px; }
  .catcard .n { font-size: 12px; }
  .catcard .ic { width: 38px; height: 38px; border-radius: 11px; }
  .box { padding: 16px; gap: 12px; }
  .crumb { font-size: 13px; margin-bottom: 10px; }
}

/* Very small phones */
@media (max-width: 360px) {
  .catgrid { gap: 8px; }
  .hero .chips { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
}

/* RTL typography: remove letter-spacing on Arabic labels */
[dir=rtl] .eyebrow { letter-spacing: 0; gap: 6px; }
[dir=rtl] .kicker { letter-spacing: 0; }

/* Arabic line-height adjustment */
html[lang=ar] body { line-height: 1.7; }
html[lang=ar] h2,
html[lang=ar] h3 { line-height: 1.35; }
html[lang=ar] .hero h1 { line-height: 1.3; }
html[lang=ar] .card .body h3 { font-size: 18px; line-height: 1.45; }
html[lang=ar] .summary { font-size: 15px; line-height: 1.65; }

/* RTL: flip the search icon side */
[dir=rtl] .search .in { flex-direction: row-reverse; }

/* RTL: card share button */
[dir=rtl] .card > .shbtn { right: auto; left: 10px; }

/* RTL: details/summary chevrons */
[dir=rtl] .dt summary { flex-direction: row-reverse; }

/* Scrollbar: thinner on Mac/Windows */
.rail::-webkit-scrollbar { height: 4px; }
.rail::-webkit-scrollbar-track { background: transparent; }
.rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.rail::-webkit-scrollbar-thumb:hover { background: var(--teal); }

/* ── 6. Loading/error state UI (used by bootstrap.js) ───────────────────── */

.acad-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
  padding: 40px 20px;
}
.acad-loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3.5px solid var(--line, #DCE3EC);
  border-top-color: var(--teal, #17A2A0);
  animation: acad-spin .65s linear infinite;
}
@keyframes acad-spin { to { transform: rotate(360deg); } }
.acad-loading-text {
  color: var(--muted, #4B5B70);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
}

.acad-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 56px 20px;
  text-align: center;
}
.acad-error-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--soft, #F3F7FA);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #4B5B70);
}
.acad-error p {
  color: var(--muted, #4B5B70);
  font-size: 15px;
  max-width: 380px;
  margin: 0;
  line-height: 1.6;
}
.acad-error .acad-retry {
  min-height: 46px;
  padding: 0 28px;
  border-radius: 12px;
  background: var(--teal, #17A2A0);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: filter .15s;
}
.acad-error .acad-retry:hover { filter: brightness(1.07); }
