/* Load after legacy.css, styles.css, scenes.css and puzzle.css.
   Layout-only refinements; intro and independent animation effects are not owned here. */

/* Retire legacy full-page sweeps, not the scene canvases or new named effects. */
body.national-experience::before,
body.national-experience::after,
body.national-experience #app .panel.active::before {
  content: none !important;
  display: none !important;
}

/* Flex/grid children may shrink; Arabic still wraps at normal word boundaries. */
body.national-experience #app :where(
  .site-header > *, .header-actions, .card, .card > *,
  .wing-heading, .panel-homebar > *, .value-module, .value-module > *,
  .honor-list article, .pledge-layout > *, .pledge-item,
  .artwork-card, .voice-card, .children-journey button,
  .tree-caption, .tree-bottom > *, .footer-links > *
) {
  min-width: 0;
}
body.national-experience #app :where(
  .card, .wing-heading, .honor-list article, .value-module,
  .pledge-item, .artwork-card, .voice-card, .children-journey,
  .tree-caption, .tree-bottom, .closing-scene, .footer-links
) :where(h2, h3, h4, p, b, small, a, span) {
  max-width: 100%;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  letter-spacing: normal;
}

body.national-experience #app .wing-visual {
  width: 100%;
  min-width: 0;
  margin: 0 0 24px;
}
body.national-experience #app .wing-visual img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  border-radius: 8px;
}
body.national-experience #app .wing-visual figcaption {
  max-width: 100%;
  padding: 10px 0;
  font-size: 12px;
  line-height: 1.85;
  word-break: normal;
  overflow-wrap: break-word;
}
body.national-experience #messageAudio {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 16px 0;
}

/* Caption, interactive tree and status are three separate flow rows. */
body.national-experience #app .tree-theatre {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
}
body.national-experience #app .tree-caption,
body.national-experience #app .tree-bottom {
  position: relative;
  inset: auto;
  flex: none;
  width: 100%;
  max-width: none;
}
body.national-experience #app .tree-theatre .scene-host[data-scene="tree"] {
  position: relative;
  inset: auto;
  flex: none;
  min-height: var(--scene-tree-min-height, 650px);
  height: var(--scene-tree-min-height, 650px);
}
body.national-experience #app .tree-caption p,
body.national-experience #app .tree-bottom {
  font-size: 12px;
  line-height: 1.85;
}
body.national-experience #app .tree-bottom {
  flex-wrap: wrap;
  gap: 6px 20px;
}

/* Only orbit rings are absolute. The numeral owns an ordinary, readable box. */
body.national-experience #app .future-orbit > span {
  position: relative;
  inset: auto;
  z-index: 1;
  max-width: 100%;
  padding-inline: 12px;
  font-size: clamp(52px, 12vw, 90px);
  line-height: 1.2;
  letter-spacing: 0;
  direction: ltr;
  transform: none;
}

/* Explicit tracks prevent intrinsic heading width from stretching a tile. */
body.national-experience #app .children-journey {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}
body.national-experience #app .children-journey button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  height: auto;
  white-space: normal;
}
body.national-experience #app .children-journey h3 {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 29px);
  line-height: 1.55;
}
body.national-experience #app .children-journey p {
  margin: 0;
  font-size: 13px;
  line-height: 1.85;
}

/* The page footer alone owns the closing treatment, not nested card footers. */
body.national-experience #app > footer {
  margin: 0;
  padding: 0;
  background: #041710;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  line-height: 1.85;
}
body.national-experience #app .panel footer {
  margin: 0;
  padding: 12px 0 0;
  background: transparent;
  border-top: 1px solid var(--line);
  text-align: start;
  font-size: 12px;
  line-height: 1.85;
}

/* Words above the flag, never over its shahada. Both remain in normal flow. */
body.national-experience #app > footer .closing-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  padding: clamp(36px, 5vw, 64px) 22px 0;
  isolation: isolate;
}
body.national-experience #app .closing-scene > div:not(.scene-host):not(.scene-shade) {
  position: relative;
  inset: auto;
  order: 0;
  width: min(100%, 820px);
  min-width: 0;
  z-index: 2;
}
body.national-experience #app .closing-scene > .scene-shade {
  display: none;
}
body.national-experience #app .closing-scene > #closingScene {
  position: relative;
  inset: auto;
  order: 1;
  flex: none;
  width: min(100%, 920px);
  min-height: 0;
  height: clamp(230px, 35vw, 390px);
  margin-top: 24px;
  border-top: 1px solid var(--line);
}
body.national-experience #app .closing-scene h2 {
  margin: 18px 0 12px;
  font-size: clamp(36px, 7vw, 64px);
  line-height: 1.45;
}
body.national-experience #app .closing-scene h3 {
  margin: 0 0 14px;
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.6;
}
body.national-experience #app .closing-scene p {
  margin: 0;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.95;
}
body.national-experience #app .closing-scene .closing-credits {
  margin: 22px 0 0;
  font-size: 13px !important;
  line-height: 2;
}
body.national-experience #app > footer .footer-links {
  margin: 0;
  padding: 22px 24px max(24px, env(safe-area-inset-bottom));
  gap: 12px 24px;
}
body.national-experience #app > footer .footer-links a,
body.national-experience #app > footer .footer-links button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: 13px;
  line-height: 1.8;
}
body.national-experience #app > footer #activity {
  flex-basis: 100%;
  font-size: 12px;
  line-height: 1.8;
}

body.national-experience #app .site-header p {
  font-size: 12px;
  line-height: 1.75;
}
body.national-experience #app .site-header p.small {
  font-size: 11px;
}

@media (max-width: 700px) {
  html {
    scroll-padding-top: calc(var(--header-height, 135px) + 64px);
  }
  body.national-experience #app .site-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    text-align: center;
  }
  body.national-experience #app .site-header .headlogos,
  body.national-experience #app .site-header p.small {
    display: none;
  }
  body.national-experience #app .site-header h2 {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: 24px;
    line-height: 1.5;
  }
  body.national-experience #app .site-header p:not(.small) {
    grid-column: 1;
    grid-row: 2;
  }
  body.national-experience #app .header-actions {
    grid-column: 1;
    grid-row: 3;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding-top: 5px;
  }
  body.national-experience #app .header-actions .icon-button {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.7;
  }
  body.national-experience #app .national-tabs a {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.65;
  }
  body.national-experience #app .national-tabs a span {
    font-size: 11px;
  }
  body.national-experience #app .children-journey {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.national-experience #app .children-journey button {
    padding: 22px 14px;
  }
  body.national-experience #app .tree-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* One generous column on narrow phones instead of squeezing Arabic titles. */
@media (max-width: 380px) {
  body.national-experience #app .children-journey {
    grid-template-columns: minmax(0, 1fr);
  }
}
