/* ============================================================
   Gan Champions 41 — unified design layer
   Loaded last on every page. Everything is scoped to
   body:not(.access-contrast32) so the accessibility modes
   (contrast, readable font, grayscale) keep full control.
   ============================================================ */

/* ---------- Typography: self-hosted Rubik (SIL OFL 1.1) ---------- */
@font-face {
  font-family: "Rubik41";
  src: url("assets/fonts/rubik-hebrew.woff2?v=197b6dbe5c") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Rubik41";
  src: url("assets/fonts/rubik-latin.woff2?v=691cd1d9b4") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ds-font: "Rubik41", system-ui, "Segoe UI", Arial, sans-serif;
  --ds-navy-900: #0d2547;
  --ds-navy-800: #143563;
  --ds-navy-700: #1b4580;
  --ds-ink: #172f52;
  --ds-ink-soft: #4a5f7d;
  --ds-paper: #fffdf7;
  --ds-cream: #fff7e3;
  --ds-line: #dfe6ef;
  --ds-gold-300: #ffe79a;
  --ds-gold-400: #ffd257;
  --ds-gold-600: #b77d12;
  --ds-gold-ink: #4f3206;
  --ds-radius-s: 12px;
  --ds-radius-m: 16px;
  --ds-radius-l: 24px;
  --ds-shadow-1: 0 1px 2px #0d25470f, 0 2px 6px #0d25470d;
  --ds-shadow-2: 0 2px 4px #0d254712, 0 10px 24px #0d254718;
  --ds-shadow-3: 0 4px 10px #04112a26, 0 18px 40px #04112a33;
  --ds-ease: cubic-bezier(.2, .7, .2, 1);
}

body:not(.access-contrast32):not(.access-font32),
body:not(.access-contrast32):not(.access-font32) :is(button, input, select, textarea, h1, h2, h3, h4, .pill, .btn, .hero-cta) {
  font-family: var(--ds-font) !important;
}
body:not(.access-contrast32) {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body:not(.access-contrast32) :is(h1, h2, h3) {
  letter-spacing: -.01em;
  line-height: 1.2;
  text-wrap: balance;
}
body:not(.access-contrast32) p { text-wrap: pretty; }

/* ---------- Buttons: one consistent system ---------- */
body:not(.access-contrast32) .hero-cta {
  border-radius: var(--ds-radius-m);
  border: 1px solid #ffffffb3;
  background: #ffffff;
  color: var(--ds-ink);
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: var(--ds-shadow-1), inset 0 -2px 0 #0d25471a;
  transition: transform .15s var(--ds-ease), box-shadow .15s var(--ds-ease), background-color .15s;
}
body:not(.access-contrast32) .hero-cta:hover {
  filter: none;
  transform: translateY(-1px);
  box-shadow: var(--ds-shadow-2), inset 0 -2px 0 #0d25471a;
}
body:not(.access-contrast32) .hero-cta:active {
  transform: translateY(1px);
  box-shadow: var(--ds-shadow-1);
}
body:not(.access-contrast32) .hero-cta-main,
body.visual-polish35:not(.access-contrast32) .hero-cta-main {
  background: linear-gradient(180deg, var(--ds-gold-300), var(--ds-gold-400));
  border-color: #fff3c4;
  color: var(--ds-gold-ink);
  font-weight: 800;
  box-shadow: inset 0 1px 0 #fffc, inset 0 -3px 0 #c98d1a66, 0 6px 18px #9a650f40;
}
body:not(.access-contrast32) .hero-cta-main:hover {
  box-shadow: inset 0 1px 0 #fffc, inset 0 -3px 0 #c98d1a66, 0 10px 24px #9a650f55;
}

/* ---------- Home: calmer hierarchy ---------- */
body.royal-home:not(.access-contrast32) .site-brand h1 {
  font-weight: 800;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
}
body.royal-home:not(.access-contrast32) .site-brand p {
  font-weight: 500;
  opacity: .92;
}
/* Parent strip: a quiet utility bar, not a second hero */
body.royal-home:not(.access-contrast32) .parent-strip34 {
  background: #ffffffeb;
  border: 1px solid #ffffff;
  border-radius: var(--ds-radius-l);
  box-shadow: var(--ds-shadow-2);
  padding: 10px 16px;
}
body.royal-home:not(.access-contrast32) .parent-strip34-actions .hero-cta,
body.royal-home:not(.access-contrast32) .parent-strip34-actions .hero-cta-share {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--ds-line);
  background: #f5f8fc;
  color: var(--ds-ink);
  font-size: .9rem;
  font-weight: 600;
  box-shadow: none;
}
body.royal-home:not(.access-contrast32) .parent-strip34-actions .hero-cta:hover {
  background: #fff4cf;
  border-color: #e9c66a;
  transform: none;
}
body.royal-home:not(.access-contrast32) .parent-strip34-actions .hero-cta-share {
  background: #e9f9f0;
  border-color: #b6e6cb;
  color: #0d5131;
}
body.royal-home:not(.access-contrast32) #question-fullscreen {
  border-radius: 999px;
  border: 1px solid #ffffff55;
  background: #ffffff1f;
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}
/* Secondary links under the illustrated map */
body.royal-home:not(.access-contrast32) main > .home-utilities:last-of-type {
  gap: 8px;
  margin-top: 18px;
}
body.royal-home:not(.access-contrast32) main > .home-utilities:last-of-type :is(a, button) {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid #ffffff4d;
  background: #ffffff14;
  color: #f4f8ff;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  box-shadow: none;
  transition: background-color .15s, border-color .15s;
}
body.royal-home:not(.access-contrast32) main > .home-utilities:last-of-type :is(a, button):hover {
  background: #ffffff29;
  border-color: #ffe08d;
}
body.royal-home:not(.access-contrast32) .home-credit35 {
  font-weight: 500;
  opacity: .9;
}

/* ---------- Top navigation bar (all play pages) ---------- */
body:not(.access-contrast32) .kingdom-bar a {
  font-weight: 600;
  transition: background-color .15s, border-color .15s, color .15s;
}

/* ---------- games.html: section heading must not collapse on phones ---------- */
body:not(.access-contrast32) .sectionTitle {
  flex-wrap: wrap;
  row-gap: 12px;
}
body:not(.access-contrast32) .sectionTitle h2 {
  flex: 1 0 auto;
  white-space: nowrap;
  font-weight: 800;
}
body.question-view:not(.access-contrast32) .sectionTitle h2 {
  color: #fff;
  text-shadow: 0 2px 8px #0d2547b3;
}
body:not(.access-contrast32) .bonusButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 640px) {
  body:not(.access-contrast32) .sectionTitle { flex-direction: column; align-items: stretch; }
  body:not(.access-contrast32) .sectionTitle h2 { font-size: 1.5rem; }
  body.royal-home:not(.access-contrast32) .parent-strip34-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  body.royal-home:not(.access-contrast32) .parent-strip34-actions .hero-cta { width: 100%; font-size: .85rem; padding-inline: 8px; }
  body.royal-home:not(.access-contrast32) .parent-strip34-actions .hero-cta[hidden] { display: none; }
  body:not(.access-contrast32) .bonusButtons { display: grid; grid-template-columns: 1fr 1fr; }
  body:not(.access-contrast32) .bonusButtons .pill { justify-content: center; text-align: center; }
}
/* Sound-check strip: same surface language as other cards */
body.question-view:not(.access-contrast32) .app > .audio-tools {
  border-radius: var(--ds-radius-m);
  box-shadow: var(--ds-shadow-1);
}

/* ---------- Cards & surfaces ---------- */
body:not(.access-contrast32) :is(.tile, .play-topic-grid > a, .endless-topics a, .catalog-card) {
  transition: transform .18s var(--ds-ease), box-shadow .18s var(--ds-ease);
}
@media (hover: hover) {
  body:not(.access-contrast32) :is(.tile, .play-topic-grid > a, .endless-topics a):hover {
    transform: translateY(-3px);
    box-shadow: var(--ds-shadow-3);
  }
}

/* ---------- Forms ---------- */
body:not(.access-contrast32) :is(input[type="text"], input[type="email"], input[type="search"], input:not([type]), select, textarea) {
  border-radius: var(--ds-radius-s);
  border: 1px solid #c8d3e1;
  background-color: #fff;
  color: var(--ds-ink);
  min-height: 46px;
  padding-inline: 12px;
  transition: border-color .15s, box-shadow .15s;
}
body:not(.access-contrast32) :is(input, select, textarea):focus-visible {
  border-color: var(--ds-navy-700);
  box-shadow: 0 0 0 4px #1b45802e;
  outline: none;
}
body:not(.access-contrast32) input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--ds-navy-700);
  vertical-align: middle;
}

/* ---------- Footer: one readable footer everywhere ---------- */
body:not(.access-contrast32) .access-footer32,
body:not(.royal-home):not(.access-contrast32) footer.access-footer32 {
  max-width: 1120px;
  margin: 32px auto 0;
  padding: 14px 20px;
  border-radius: var(--ds-radius-l) var(--ds-radius-l) 0 0;
  border: 1px solid var(--ds-line);
  border-bottom: 0;
  background: var(--ds-paper) !important;
  color: var(--ds-ink) !important;
  font: 500 15px/1.6 var(--ds-font);
  gap: 6px 22px;
  box-shadow: 0 -4px 24px #0d254712;
}
body:not(.access-contrast32):not(.access-font32) .access-footer32 { font-family: var(--ds-font) !important; }
body:not(.access-contrast32) .access-footer32 a,
body:not(.royal-home):not(.access-contrast32) footer.access-footer32 a {
  color: var(--ds-navy-700) !important;
  text-decoration: none;
  font-weight: 600;
  border-radius: 8px;
  padding-inline: 6px;
}
body:not(.access-contrast32) .access-footer32 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* Leave room so the floating accessibility and Nori buttons never cover content */
@media (max-width: 720px) {
  body:not(.access-contrast32) .access-footer32 {
    margin-top: 24px;
    padding: 14px 16px 92px;
    gap: 4px 14px;
    border-radius: var(--ds-radius-l) var(--ds-radius-l) 0 0;
  }
}

/* ---------- Focus visibility (keyboard) ---------- */
body:not(.access-contrast32) :is(a, button, [role="button"]):focus-visible {
  outline: 3px solid var(--ds-gold-400);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #0d254766;
}

/* ---------- Motion respect ---------- */
@media (prefers-reduced-motion: reduce) {
  body:not(.access-contrast32) :is(.hero-cta, .tile, .play-topic-grid > a, .endless-topics a) {
    transition: none;
  }
  body:not(.access-contrast32) :is(.hero-cta, .tile, .play-topic-grid > a, .endless-topics a):hover {
    transform: none;
  }
}
body.access-motion32 :is(.hero-cta, .tile, .play-topic-grid > a, .endless-topics a) {
  transition: none !important;
  transform: none !important;
}

/* ---------- 41.1: one top bar on play pages ----------
   common31.js moves the page navigation (.kingdom-bar) into the
   profile bar, so children see a single bar instead of three. */
body:not(.access-contrast32) .profile31.profile41 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 12px;
  padding: 10px max(16px, calc((100vw - 1240px) / 2));
  background: linear-gradient(180deg, var(--ds-navy-800), var(--ds-navy-900));
  border-bottom: 3px solid var(--ds-gold-400);
  box-shadow: 0 6px 18px #04112a40;
  color: #f4f8ff;
}
body:not(.access-contrast32) .profile31.profile41 > a:first-child {
  width: auto;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  margin-inline-end: 6px;
}
body:not(.access-contrast32) .profile31.profile41 > .kingdom-bar41 {
  margin: 0;
  padding: 0;
  max-width: none;
  width: auto;
  flex: 0 1 auto;
  display: flex;
  gap: 6px;
  background: none;
  border: 0;
  box-shadow: none;
}
body:not(.access-contrast32) .profile31.profile41 > .kingdom-bar41 a {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #ffffff38;
  background: #ffffff14;
  color: #f4f8ff;
  font-size: .95rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: none;
}
body:not(.access-contrast32) .profile31.profile41 > .kingdom-bar41 a:hover {
  background: #ffffff29;
  color: #fff;
}
body:not(.access-contrast32) .profile31.profile41 > .kingdom-bar41 a[aria-current="page"] {
  background: var(--ds-gold-400);
  border-color: var(--ds-gold-300);
  color: var(--ds-gold-ink);
}
body:not(.access-contrast32) .profile31.profile41 > label {
  margin-inline-start: auto; /* pushes the child controls to the far side */
  color: #dfe8f7;
  font-size: .9rem;
  font-weight: 500;
}
body:not(.access-contrast32) .profile31.profile41 select {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid #ffffff55;
}
body:not(.access-contrast32) .profile31.profile41 #wallet31 {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff2c2;
  color: var(--ds-gold-ink);
  font-weight: 700;
  box-shadow: none;
}
body:not(.access-contrast32) .profile31.profile41 > a.compact-desktop-link:not(:first-child) {
  color: #dfe8f7;
  font-size: .9rem;
  font-weight: 600;
}
body:not(.access-contrast32) .profile31.profile41 .audio-enable31 {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
body:not(.access-contrast32) .profile31.profile41 .audio-enable31 button {
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 700;
  box-shadow: none;
}
body:not(.access-contrast32) .profile31.profile41 .audio-enable31 [role="status"] {
  font-size: .8rem;
  color: #c9d6ea;
  max-width: 16ch;
  line-height: 1.25;
}
/* The games page strip repeated the sound check already in the bar */
body:not(.access-contrast32) .profile41 ~ .app > .audio-tools,
body.question-view:not(.access-contrast32):has(.profile41) .app > .audio-tools {
  display: none;
}

@media (max-width: 720px) {
  body:not(.access-contrast32) .profile31.profile41 {
    gap: 8px;
    padding: 8px 10px;
  }
  body:not(.access-contrast32) .profile31.profile41 > a.compact-desktop-link,
  body:not(.access-contrast32) .profile31.profile41 .audio-enable31 [role="status"] {
    display: none;
  }
  body:not(.access-contrast32) .profile31.profile41 > .kingdom-bar41 {
    order: -1;
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  body:not(.access-contrast32) .profile31.profile41 > .kingdom-bar41 a {
    justify-content: center;
    padding: 6px 6px;
    font-size: .82rem;
    gap: 4px;
  }
  body:not(.access-contrast32) .profile31.profile41 > label {
    margin-inline-start: 0;
    font-size: 0; /* keep the select, drop the "playing with" prefix */
  }
  body:not(.access-contrast32) .profile31.profile41 > label select { font-size: .9rem; max-width: 112px; }
  body:not(.access-contrast32) .profile31.profile41 > .kingdom-bar41 a > span[aria-hidden="true"] { display: none; }
  body:not(.access-contrast32) .profile31.profile41 .mobile-play-nav { flex: 1 1 100%; order: 5; margin: 0; }
  body:not(.access-contrast32) .profile31.profile41 .mobile-play-nav a[href="index.html"] { display: none; }
}

/* v42.0.0-beta.3: phone home screen - parent links fold behind one button (contrast mode keeps every link visible) */
body:not(.access-contrast32) .parents-fold42,body.access-contrast32 .parents-fold42{display:none}
@media(max-width:700px){
 body.royal-home:not(.access-contrast32):not(.parents-open42) .parent-strip34-actions,body.royal-home:not(.access-contrast32):not(.parents-open42) .home-utilities{display:none!important}
 body.royal-home:not(.access-contrast32) .parents-fold42{display:block;width:100%;min-height:48px;margin-top:8px;border-radius:16px;border:2px solid #c9d8ea;background:#f4f8ff;color:#163a78;font:inherit;font-weight:700;cursor:pointer}
 body.royal-home.parents-open42:not(.access-contrast32) .parents-fold42{background:#ffe9a8;border-color:#d2a33c}
}

/* v42.0.0-beta.3: phone games yard - the child's first game shows sooner; parent links stay under "עוד אפשרויות" */
@media(max-width:700px){
 body.compact-play:not(.access-contrast32) #screen #parent,body.compact-play:not(.access-contrast32) #screen a.btn[href="learning-center.html"]{display:none!important}
 body.compact-play:not(.access-contrast32) .top a.pill[href="arcade.html"]{display:none!important}
}
