/* ==========================================================================
   Wondermaths - illustrated five-world selector for the five world pages.
   Replaces the old .realm-switcher pill nav. Desktop renders the approved
   homepage board (assets/home-20260924/worlds.webp, 1536x1024) with five
   full-tile links; below 1100px it renders the five native world cards from
   the same homepage assets. Loaded after worlds-living.css. Colours come
   from the portal / world tokens (--wl-*), so the Magic Realm page keeps its
   own purple without a separate rule.
   ========================================================================== */

.world-selector {
  background: #fff;
  border-block: 1px solid var(--wl-mint, #D2F9F6);
  padding-block: clamp(22px, 3vw, 40px);
}
.world-selector img { display: block; max-width: 100%; }
.world-selector-desktop { display: block; }
.world-selector-native { display: none; }

/* Board: the full 3:2 artwork, never cropped and never re-rounded. */
.world-selector .ws-board { position: relative; max-width: 1240px; margin: 0 auto; }
.world-selector .ws-board > img { width: 100%; height: auto; }
:root[data-portal-theme] body .world-selector .ws-board > img {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: fill !important;
  border-radius: 0 !important;
}

/* Full-tile overlay links. */
.world-selector .ws-hotspot {
  position: absolute;
  display: block;
  border-radius: 16px;
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
}
.world-selector .ws-hotspot:hover {
  background: rgba(23, 74, 126, .12);
  box-shadow: inset 0 0 0 3px rgba(23, 74, 126, .45);
}
.world-selector .ws-hotspot:focus-visible {
  background: rgba(23, 74, 126, .16);
  outline: 3px solid #174A7E;
  outline-offset: 2px;
}
.world-selector .ws-forest { left: 0;   top: 10%; width: 33%; height: 44%; }
.world-selector .ws-farm   { left: 33%; top: 10%; width: 33%; height: 44%; }
.world-selector .ws-water  { left: 66%; top: 10%; width: 34%; height: 44%; }
.world-selector .ws-sky    { left: 10%; top: 54%; width: 40%; height: 46%; }
.world-selector .ws-magic  { left: 50%; top: 54%; width: 45%; height: 46%; }

/* Native cards (< 1100px): five real links, two per row on phones, three on
   tablets, short rows centred by flex. */
.world-selector .world-selector-native h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 32px);
  line-height: 1.14;
  letter-spacing: -.01em;
}
.world-selector .ws-lede {
  margin: 10px 0 0;
  font-size: 18px;
  line-height: 1.5;
  color: var(--wl-ink, #17324D);
  max-width: 56ch;
}
.world-selector .ws-grid {
  list-style: none;
  margin: clamp(18px, 2.6vw, 30px) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(12px, 2.2vw, 24px);
}
.world-selector .ws-grid > li {
  flex: 0 1 calc((100% - clamp(12px, 2.2vw, 24px)) / 2);
  min-width: 0;
}
.world-selector .ws-grid a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 44px;
  text-decoration: none;
}
.world-selector .ws-shot {
  display: block;
  overflow: hidden;
  background: var(--wl-mint, #D2F9F6);
  border-radius: 50% 50% 18px 18px / 30% 30% 18px 18px;
}
.world-selector .ws-shot img { width: 100%; height: auto; object-fit: cover; }
:root[data-portal-theme] body .world-selector .ws-shot img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 4 / 3 !important;
  object-fit: cover !important;
  border-radius: 50% 50% 18px 18px / 30% 30% 18px 18px !important;
}
.world-selector .ws-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0 4px;
}
.world-selector .ws-copy strong { font-size: 18px; font-weight: 650; line-height: 1.35; color: var(--wl-navy, #174A7E); }
.world-selector .ws-copy span { font-size: 18px; color: var(--wl-ink, #17324D); }
.world-selector .ws-grid a:hover .ws-copy strong { text-decoration: underline; text-underline-offset: 4px; }
.world-selector .ws-grid a[aria-current] .ws-copy strong {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Ori's Old Oak opens the section: one compact illustrated welcome entry
   above the five-world board, one full picture card on phones. */
.world-selector .ws-oak-wrap { margin: 0 0 clamp(18px, 2.4vw, 28px); }
.world-selector .ws-oak-entry {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr) 44px;
  align-items: center;
  gap: clamp(14px, 2vw, 22px);
  max-width: 1240px;
  min-height: 44px;
  margin: 0 auto;
  padding: 12px clamp(14px, 1.8vw, 20px) 12px 12px;
  text-decoration: none;
  background: var(--wl-mist, #EDFCFA);
  border: 1px solid var(--wl-mint, #D2F9F6);
  border-radius: 24px;
  box-shadow: 0 24px 36px -32px rgba(23, 74, 126, .6);
}
.world-selector .ws-oak-art {
  display: block;
  overflow: hidden;
  border-radius: 16px;
  background: var(--wl-mint, #D2F9F6);
}
.world-selector .ws-oak-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
:root[data-portal-theme] body .world-selector .ws-oak-art img {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 16 / 9 !important;
  object-fit: cover !important;
  border-radius: 16px !important;
}
.world-selector .ws-oak-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.world-selector .ws-oak-copy strong {
  font-size: clamp(20px, 2.4vw, 27px);
  line-height: 1.15;
  color: var(--wl-navy, #174A7E);
}
.world-selector .ws-oak-copy span { font-size: 18px; color: var(--wl-ink, #17324D); }
.world-selector .ws-oak-go {
  font-size: 26px;
  line-height: 1;
  text-align: center;
  color: var(--wl-navy, #174A7E);
}
.world-selector .ws-oak-entry:hover .ws-oak-copy strong {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.world-selector .ws-oak-entry:focus-visible {
  outline: 3px solid #174A7E;
  outline-offset: 3px;
}

@media (max-width: 1099px) {
  .world-selector-desktop { display: none; }
  .world-selector-native { display: block; }
}
@media (max-width: 820px) {
  .world-selector .ws-oak-entry {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px 14px;
  }
  .world-selector .ws-oak-go { display: none; }
}
@media (min-width: 600px) and (max-width: 1099px) {
  .world-selector .ws-grid > li {
    flex-basis: calc((100% - 2 * clamp(12px, 2.2vw, 24px)) / 3);
  }
}
