/* One reading hierarchy across legacy service modules. Presentation only:
   no routes, entitlements, content, icon glyphs or pedagogical demos change. */
:root {
  --nawa-type-body: 1rem;
  --nawa-type-caption: .875rem;
  --nawa-type-title: clamp(1.875rem, 2.2vw + 1rem, 3rem);
  --nawa-type-section: clamp(1.375rem, 1vw + 1rem, 2rem);
  --nawa-type-card: 1.125rem;
}
#view :is(h1,h2,h3,h4,p,button,label,small) {
  overflow-wrap: anywhere;
}
#view h1 {
  font-size: var(--nawa-type-title) !important;
  line-height: 1.22 !important;
  font-weight: 700;
}
#view h2 {
  font-size: var(--nawa-type-section) !important;
  line-height: 1.35 !important;
  font-weight: 700;
}
#view :is(h3,h4) {
  font-size: var(--nawa-type-card) !important;
  line-height: 1.4 !important;
  font-weight: 700;
}
#view p:not([data-preserve-font]) {
  font-size: var(--nawa-type-body) !important;
  line-height: 1.65 !important;
  font-weight: 400;
}
#view small:not(.material-symbols-rounded) {
  font-size: var(--nawa-type-caption) !important;
  line-height: 1.5 !important;
}
#view :is(button,.btn):not([data-preserve-font]) {
  min-width: 0;
  max-width: 100%;
  min-height: max(44px, 2.75rem);
  height: auto;
  white-space: normal;
  font-size: var(--nawa-type-body) !important;
  line-height: 1.45 !important;
  font-weight: 600;
}
#view :is(h1,h2,h3,p)[lang="ar"] { line-height: 1.65 !important; }
#view :is(input,select,textarea) { font-size: 1rem; min-width: 0; max-width: 100%; }
#view .auth-panel { min-width: 0; padding: clamp(1rem,4vw,2rem); }
#view .auth-tabs {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: .375rem;
}
#view .auth-form label { font-size: 1rem; line-height: 1.5; }
#view .lesson-card-copy > strong,
#view .lesson-art-meta :is(b,i) {
  font-size: var(--nawa-type-caption) !important;
  line-height: 1.5; white-space: normal; overflow-wrap: anywhere;
}
#view :is(.auth-form,.signup-access-detail,.signup-access-trust) { min-width: 0; }
#view .signup-access-detail {
  grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr));
}
#view .signup-access-trust {
  grid-template-columns: repeat(auto-fit,minmax(min(100%,13rem),1fr));
  font-size: .875rem;
}
#view .signup-access-choice > legend { font-size: .875rem; }
/* Important legal/permission text must never remain the legacy 8–10px. */
#view :is(.consent-note,.signup-access-detail,.signup-access-trust,.auth-panel) :is(p,small) {
  font-size: 1rem !important;
}
/* A wrapping heading row is preferable to squeezing the title into a sliver. */
#view :is(.section-head,.nawa-halo-heading) { flex-wrap: wrap; gap: 1rem; }
#view .nawa-halo-heading { grid-template-columns: minmax(0,1fr); }
#view .nawa-halo-heading > div:first-child { min-width: min(100%,15rem); flex: 1 1 18rem; }

/* Let layout tracks shrink, not their text. The default 1fr/fieldset
   min-content size otherwise grows beyond a narrow viewport at 200% text. */
#view :is(.auth-panel,.v1e-profile-page,.official-services-page) :is(div,header,section,article,fieldset,label) {
  min-inline-size: 0;
  max-inline-size: 100%;
}
#view .auth-form { grid-template-columns: minmax(0,1fr); }
#view .auth-panel fieldset { min-inline-size: 0; }
#view .auth-panel legend { max-inline-size: 100%; white-space: normal; }
#view .auth-form :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
  inline-size: 100%; box-sizing: border-box;
}
#view .living-mission-actions {
  grid-template-columns: repeat(auto-fit,minmax(min(100%,7.5rem),1fr));
}
#view .living-mission-actions :is(b,small) {
  overflow: visible; white-space: normal; text-overflow: clip; overflow-wrap: anywhere;
}
/* These cards grow with their copy instead of pinning text to an image edge. */
#view .nawa-essential-world-card {
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 22rem; padding: 1.25rem; text-align: start;
}
#view .nawa-essential-world-card > span { position: static; align-self: flex-start; margin-block-end: 6rem; }
#view .nawa-essential-world-card > div { position: static; min-width: 0; max-width: 100%; }
#view .nawa-essential-world-card b { font-size: var(--nawa-type-section); line-height: 1.35; }
#view .nawa-essential-world-card strong { font-size: 1.125rem; line-height: 1.7; }
#view .nawa-essential-world-card em { width: fit-content; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
#view .nawa-atlas .na-map-cities {
  grid-template-columns: repeat(auto-fit,minmax(min(100%,10rem),1fr));
}
#view .nawa-atlas .na-map-cities button:last-child { grid-column: auto; }
#view .official-services-hero-copy { min-inline-size: 0; }
#view .official-services-journey li { min-inline-size: 0; }
#view .official-services-truth > footer { min-inline-size: 0; }
#view .official-services-truth li { grid-template-columns: 1.5rem minmax(0,1fr); }
#view .v1e-profile-identity > header { flex-wrap: wrap; }
#view .v1e-personal-details { width: 100%; }
#view .v1e-personal-details p { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
#view .v1e-personal-details .tag,
#view .v1e-personal-privacy strong { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
#view .v1e-profile-shortcuts { grid-template-columns: repeat(auto-fit,minmax(min(100%,14rem),1fr)); }
#view .v1e-profile-shortcuts button { grid-template-columns: auto minmax(0,1fr); }
#view .provider-profile-entry { grid-template-columns: auto minmax(0,1fr); }
#view .provider-profile-entry .btn { grid-column: 1 / -1; }
#view :is(.profile-notification-settings,.profile-business-cta) {
  grid-template-columns: auto minmax(0,1fr); min-width: 0;
}
#view :is(.profile-notification-settings,.profile-business-cta) > div { min-width: 0; }
#view :is(.profile-notification-settings,.profile-business-cta) > :is(button,.btn) { grid-column: 1 / -1; }
#view .einvoice-profile-banner { grid-template-columns: auto minmax(0,1fr); }
#view .einvoice-profile-banner > * { min-inline-size: 0; max-inline-size: 100%; }
#view .einvoice-profile-banner > button { grid-column: 1 / -1; margin-inline: 0; }
/* Secondary shell information is readable too, not compressed to 6–10px.
   News stays in normal flow so enlarged copy never traps the viewport. */
@media screen {
  #flashBar { position: relative; top: auto; height: auto; min-height: 3.25rem; overflow: visible; }
  .flash-news-label { font-size: .75rem; }
  .flash-news-copy b { font-size: .875rem; line-height: 1.45; }
  .flash-news-copy small, .flash-news-link em { font-size: .75rem; line-height: 1.5; }
  .exchange-rate-corner > b { font-size: .875rem; line-height: 1.45; }
  .exchange-rate-corner > small { font-size: .75rem; line-height: 1.5; white-space: normal; }
  .flash-news-controls button { width: 44px; height: 44px; }
  .primary-nav button > span { font-size: 1rem; line-height: 1.4; }
  .primary-nav button > small { font-size: .8125rem; line-height: 1.6; }
}
@media screen and (max-width: 900px) {
  .bottom-nav { height: auto; min-height: calc(5.75rem + env(safe-area-inset-bottom,0px)); align-items: stretch; }
  .bottom-nav button { grid-template-rows: 1.5rem auto auto; align-content: start; padding: .4rem .2rem; gap: .15rem; }
  .bottom-nav :is(b,small) { display: block; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.35; }
  .bottom-nav b { font-size: .8125rem; font-weight: 600; }
  .bottom-nav small { font-size: .75rem; }
  .app-shell { padding-block-end: calc(9rem + env(safe-area-inset-bottom,0px)); }
}
.reading-menu-toggle { display: none; }
@media screen and (max-width: 900px) {
  .reading-menu-large .reading-menu-toggle {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
    position: fixed; z-index: 160; inset-inline: .75rem;
    bottom: calc(.5rem + env(safe-area-inset-bottom,0px));
    min-height: 56px; padding: 10px; border: 2px solid #c5a563; border-radius: .8rem;
    color: #fffdf6; background: #08223a; font-size: 1rem; line-height: 1.5;
  }
  .reading-menu-large .bottom-nav { display: none; }
  .reading-menu-large.reading-menu-open .bottom-nav {
    display: grid; grid-template-columns: minmax(0,1fr); gap: 6px;
    inset-inline: 12px; width: auto; border-radius: .8rem; padding: 10px;
    bottom: calc(90px + env(safe-area-inset-bottom,0px));
    height: auto; min-height: 0; max-height: 65dvh; overflow-y: auto;
    background: #08223a; border: 2px solid #c5a563; z-index: 161;
  }
  .reading-menu-large .bottom-nav button {
    display: grid; grid-template-columns: 32px minmax(0,1fr); grid-template-rows: auto auto;
    align-content: center; text-align: start; column-gap: 8px; min-height: 44px;
    padding: 10px; color: #fffdf6; background: transparent;
  }
  .reading-menu-large .bottom-nav button > span { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .reading-menu-large .bottom-nav button > :is(b,small) { grid-column: 2; color: inherit; }
  .reading-menu-large .bottom-nav button.active { background: #f3cc75; color: #08223a; }
  .reading-menu-large :is(.reading-menu-toggle,.bottom-nav button):focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
  .reading-menu-large #aiFab { bottom: calc(6rem + env(safe-area-inset-bottom,0px)); }
}
/* Connection feedback is part of the page flow, never a tiny overlay over CTAs. */
#liveSyncStatus {
  position: relative !important; inset: auto !important;
  width: fit-content; max-width: calc(100% - 1.5rem) !important;
  grid-template-columns: auto minmax(0,1fr) auto; min-height: 44px;
  margin: .5rem .75rem; padding: .65rem; box-shadow: none;
}
#liveSyncStatus :is(b,small) { display: block; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.45; }
#liveSyncStatus b { font-size: .875rem; }
#liveSyncStatus small { font-size: .75rem; }
@media screen and (max-width: 720px) {
  #flashBar { grid-template-columns: minmax(0,1fr) auto; }
  .flash-news-label { display: none; }
  .flash-news-link { grid-column: 1 / -1; padding: .5rem .75rem; }
  .flash-news-copy b { white-space: normal; overflow: visible; text-overflow: clip; }
  .exchange-rate-corner { min-width: 0; padding: .5rem .75rem; border-left: 0; }
  .flash-news-controls { padding-inline-end: .25rem; }
  #flashNewsPause { display: block; }
}
@media (max-width: 960px) {
  #view .official-services-hero { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 640px) {
  #view .auth-tabs { grid-template-columns: minmax(0,1fr); }
  #view .einvoice-profile-banner { grid-template-columns: minmax(0,1fr); }
  #view .einvoice-profile-banner > * { grid-column: 1; }
  #view :is(.profile-notification-settings,.profile-business-cta) { grid-template-columns: minmax(0,1fr); }
  #view .official-services-truth { grid-template-columns: minmax(0,1fr); }
  #view .v1e-profile-identity-grid { grid-template-columns: minmax(0,1fr); }
  #view .v1e-personal-privacy { grid-template-columns: minmax(0,1fr); }
}
