/* =========================================================
   Roya TV: polish layer (Nov 2026). Loaded LAST.
   Layout, rhythm and consistency only; colours, buttons and badges live in brand.css.
   One system for every page:
     spacing   4 · 8 · 12 · 16 · 24 · 32 · 48        (--sp-1 … --sp-7)
     type      page 26→43 · section 18→22 · card 15 · body 15-17 · meta 13 · micro 11
     radius    6 badge · 10 chip-in-group/inputs · 12 buttons · 16 cards · 24 heroes/panels · pill
     section   heading + count/sub on one line, "See all" at the end, 16px to the content
     buttons   48 tall (44 small) · chips 40 · icon buttons 44 · tap targets ≥ 44 on touch
   ========================================================= */
:root {
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --sp-section: clamp(40px, 4.4vw, 64px);          /* between rails / sections on every page */
  --sp-head: var(--sp-4);                           /* section title -> its content */
  --t-page: clamp(1.65rem, 1.2rem + 1.8vw, 2.7rem); /* page titles and tab heroes */
  --t-section: clamp(1.1rem, 0.98rem + 0.5vw, 1.4rem);
  --t-meta: 0.8125rem;
  --r-badge: 6px; --r-input: 10px; --r-btn: 12px; --r-card: 16px; --r-panel: 24px; --r-pill: 999px;
}

/* ---------- 1. page heads: one pattern (title, sub, actions at the end) ---------- */
.page-head { padding: var(--sp-6) var(--gutter) var(--sp-3); gap: var(--sp-4) var(--sp-5); align-items: flex-end; }
.page-title, .th-copy h1, .series-hero h1 { font-size: var(--t-page); font-weight: 800; line-height: 1.25; letter-spacing: 0; }
:root[dir="ltr"] .page-title, :root[dir="ltr"] .th-copy h1, :root[dir="ltr"] .series-hero h1 { letter-spacing: -0.02em; line-height: 1.12; }
.page-sub { margin-top: var(--sp-2); font-size: var(--t-meta); line-height: 1.6; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.page-actions .btn-sm { min-height: 44px; }
.toolbar { padding-block: var(--sp-2) var(--sp-3); }
.toolbar + .rails.flat, .toolbar + .grid-vod, .toolbar + .grid-ch { padding-top: var(--sp-3); }

/* header: the nav labels are shorter now ("أفلام" instead of "أفلام ومسلسلات"), so the search pill keeps its full label */
@media (min-width: 1400px) and (max-width: 1599px) { .nav .ai-trigger { width: 248px; } }

/* ---------- 2. section headers: rails, channel groups, title-page sections ---------- */
.rail-title, .region-head, .tp-sec h3, .eps-head h3, .panel > header h2 { font-size: var(--t-section); font-weight: 700; line-height: 1.5; }
:root[dir="ltr"] .rail-title, :root[dir="ltr"] .region-head { line-height: 1.3; }
.rail-head { margin-bottom: var(--sp-head); column-gap: var(--sp-3); }
.rail-sub, .region-head small { font-size: var(--t-meta); }
.rail-more { font-size: var(--t-meta); display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 32px; }
.rail-more svg { width: 16px; height: 16px; }
/* channel groups in the Live grid: same air as rails, same 16px from heading to cards */
.grid-ch { row-gap: var(--sp-5); }
.grid-ch > .region-head { margin: calc(var(--sp-section) - var(--sp-5)) 0 calc(var(--sp-head) - var(--sp-5)); }
.grid-ch > .region-head:first-child { margin-top: var(--sp-2); }
.region-head svg { width: 20px; height: 20px; }
.tp-sec h3 { margin: 0 0 var(--sp-head); }

/* ---------- 3. vertical rhythm: one gap between sections everywhere ---------- */
.rails { gap: var(--sp-section); row-gap: var(--sp-section); padding-bottom: var(--sp-section); }
.rail + .rail, .page-home.calm .rail + .rail { margin-top: 0; }
.page-home.calm .rails { padding-top: var(--sp-5); }
.tab-rails { padding-top: var(--sp-section); }

/* ---------- 4. heroes: every tab hero sits on the same grid, same radius, same top gap ---------- */
.tab-hero, .series-hero { margin: var(--sp-4) var(--gutter) 0; border-radius: var(--r-panel); }
.series-hero { min-height: clamp(360px, 34vw, 460px); }
.series-hero .sh-copy { padding: clamp(24px, 4.6vw, 60px); gap: var(--sp-3); }
.series-hero + .rails.tab-rails { padding-top: var(--sp-section); }
.series-live-link { margin: 0 var(--gutter) var(--sp-section); min-height: 56px; }
.series-live-link svg:last-child { flex: none; color: var(--text-3); }
.th-copy { gap: var(--sp-3); }
.th-actions { gap: var(--sp-2); margin-top: var(--sp-2); }

/* ---------- 5. empty states: one calm block ---------- */
.empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-7) var(--gutter); color: var(--text-3); }
.empty > svg, .empty > .ri { width: 44px; height: 44px; margin: 0 0 var(--sp-2); opacity: 0.55; }
.empty h2 { margin: 0; color: var(--text); font-size: var(--t-section); line-height: 1.5; }
.empty p { margin: 0; max-width: 46ch; line-height: 1.8; }
.empty .th-actions { justify-content: center; margin-top: var(--sp-3); }

/* ---------- 6. title page ---------- */
/* the big poster is decoration: when it has real artwork the page title is already beside it */
.tp-poster .pcard.kv:not(.noart) .rp-key { display: none; }
.tp-poster .pcard.kv:not(.noart) .rp-fade { opacity: 0.35; }
.tp-sec { padding-top: var(--sp-6); }
.tp-sec .grid-vod { padding-bottom: var(--sp-6); }

/* multiview: same page head as Live, screens on the page grid */
.mv-page .mv { padding: var(--sp-2) var(--gutter) var(--sp-7); gap: var(--sp-2); }

/* ---------- 7. studio (staff page): never wider than the screen ---------- */
.studio { grid-template-columns: minmax(0, 1fr); }
.studio .page-head { padding-inline: 0; }
.stat small { letter-spacing: 0; }
:root[dir="ltr"] .stat small { letter-spacing: 0.06em; }

/* ---------- 8. touch & Arabic details ---------- */
:root[dir="rtl"] .page-sub, :root[dir="rtl"] .th-copy p, :root[dir="rtl"] .empty p { line-height: 1.8; }
.region-head small { line-height: 1.7; }
@media (pointer: coarse) {
  .rail-more { min-height: 44px; }
  .page-actions .btn, .page-actions .seg a { min-height: 44px; }
}

/* ---------- 9. tablet ---------- */
@media (max-width: 960px) {
  .page-head { padding-top: var(--sp-5); }
  /* seven tabs share the bar: slimmer icon pill so labels never touch */
  .tabbar .tb-ic { width: 44px; }
  .tabbar .tb-label { font-size: 10px; }
}

/* ---------- 10. phones ---------- */
@media (max-width: 600px) {
  .page-head { padding: var(--sp-5) var(--gutter) var(--sp-2); gap: var(--sp-3); }
  .page-head > div:first-child { flex: 1 1 100%; }
  /* Live head: TV/Radio switch full width, Multiview + Guide share the next row */
  .page-actions { width: 100%; }
  .page-actions > .seg { flex: 1 1 100%; display: flex; }
  .page-actions > .seg a { flex: 1; justify-content: center; }
  .page-actions > .btn { flex: 1 1 0; min-width: 0; }
  .tab-hero, .series-hero { margin-top: var(--sp-2); border-radius: 20px; }
  .series-hero .sh-copy { padding: 22px 18px; }
  .series-hero h1 { line-height: 1.3; }
  /* hero buttons: one tidy column of equal width */
  .th-actions { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .th-actions > .btn { width: 100%; }
  .th-actions > .seg { width: 100%; display: flex; }
  .th-actions > .seg a { flex: 1; justify-content: center; }
  .th-actions > .btn-ghost { justify-self: center; width: auto; }
  .series-live-link { padding: 14px 16px; }
  .studio .form { grid-template-columns: minmax(0, 1fr); }
  .studio .form .field { grid-column: 1 / -1 !important; }
  .studio .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio .stat b { font-size: 1.6rem; }
}
@media (max-width: 380px) {
  .tabbar .tb-ic { width: 40px; }
  .tabbar .tb-label { font-size: 9.5px; }
}

/* ===== Badges, calm glass style (2026-11-28): one quiet system on every card =====
   Live: dark glass pill, red pulse dot, white label. Premium: dark glass, gold crown and label, gold hairline.
   No gradients, no coloured glows. Quality and rating share the same glass. */
.badge-live, .ccard .badge-live, .sc-logo .badge-live {
  background: rgba(10, 11, 15, 0.62); color: #fff; font-weight: 600; letter-spacing: 0.04em; gap: 6px;
  min-height: 22px; padding: 0 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3); text-shadow: none;
}
.badge-live::before { width: 6px; height: 6px; background: #ff3b47; box-shadow: 0 0 0 3px rgba(255, 59, 71, 0.22); animation: blink 1.6s ease-in-out infinite; }
:root[dir="rtl"] .badge-live { letter-spacing: 0; }
.badge-premium, .badge-gold, .ccard .ch-tags .badge-premium, .pcard.kv .rp-prem {
  background: rgba(10, 11, 15, 0.62); color: #e9c46a; font-weight: 600; border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(233, 196, 106, 0.38);
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3); text-shadow: none;
}
.badge-premium svg, .badge-gold svg, .pcard.kv .rp-prem svg { color: #e9c46a; }
.badge-lock { min-height: 22px; padding: 0 9px; font-size: 10.5px; }
.ccard .q, .badge-rating {
  background: rgba(10, 11, 15, 0.62); color: rgba(255, 255, 255, 0.86); border: 0; border-radius: 999px; min-height: 22px; height: auto; padding: 0 9px;
  font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3);
}
.badge-rating.r18 { color: #ff8f96; background: rgba(10, 11, 15, 0.62); box-shadow: inset 0 0 0 1px rgba(255, 90, 100, 0.5); }
@media (prefers-reduced-motion: reduce) { .badge-live::before { animation: none; } }

/* Footer brand: air between the wordmark and its tagline */
.foot-logo { gap: 14px; }
.foot-logo .brand-word { line-height: 1.25; }
.foot-logo .foot-tag { display: block; margin-top: 9px; line-height: 1.5; }

/* Header wordmark: room for the hamza and the dots (the letters carry hair spaces in the markup) */
.nav .brand-word { line-height: 1.3; font-size: 1.28rem; }
.nav .brand-word small { margin-top: 1px; font-size: 10.5px; line-height: 1.4; }
:root[dir="rtl"] .nav .brand-word small { letter-spacing: 0.04em; font-size: 11px; }
/* Radio search: text never touches the pill's edge */
.r-search { padding-inline: 4px 6px; height: 48px; }
.r-search input { padding-inline: 10px 14px; }
.r-search > svg, .r-search > i { margin-inline: 14px 4px; }

/* Off-air Libyan channels: listed, dimmed, clearly not live */
.ccard.off-air { cursor: default; }
.ccard.off-air .thumb { filter: grayscale(0.85) brightness(0.62); }
.ccard.off-air .ch-logo { filter: none; }
.badge-off { background: rgba(10, 11, 15, 0.72); color: rgba(255, 255, 255, 0.82); border-radius: 999px; min-height: 22px; padding: 0 9px; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.ccard.off-air .body .name { color: var(--text-2); }
.ccard.off-air:hover { transform: none; }
.ccard.off-air .ch-name-row { color: var(--text-2); }
.ccard.off-air .off-line { color: var(--text-3); font-size: var(--fs-s); margin-top: 4px; }

/* Off-air cards keep their logo clear and in colour; only the stage is calmed and the badge says off air */
.ccard.off-air .thumb { filter: none; }
.ccard.off-air .thumb.ch-stage { background-color: #0c0d12; }
.ccard.off-air .ch-brand { opacity: 0.92; }
.ccard.off-air .ch-mono { opacity: 0.6; }

/* Sign-in sheet: no "developer mode" tags or notes on screen (owner request; the providers are connected later) */
.ra-devtag, .ra-devnote { display: none !important; }
