/* Permanent public heading scale. Only typography: existing colours and light stay intact.
   Layered important declarations override legacy unlayered font rules without
   escalating selectors or touching their gradients, shadows and backgrounds. */
@layer h7-typography {
 :root {
  --h7-heading-font:'DM Sans',Arial,'Amiri',sans-serif;
  --h7-heading-1:clamp(1.65rem,1.2rem + 1.8vw,2.5rem);
  --h7-heading-2:clamp(1.25rem,1.06rem + .8vw,1.7rem);
  --h7-heading-3:clamp(1.08rem,1rem + .35vw,1.3rem);
 }
 body :is(.page:not(.admin-page),.translation-document):lang(ar){--h7-heading-font:'Amiri',Tahoma,serif}
 body :is(.page:not(.admin-page),.translation-document) :is(h1,h2,h3,h4,h5,h6):not(.home-site-title),
 body :is(.page:not(.admin-page),.translation-document) :is(.portal-title,.eyebrow) {
  font-family:var(--h7-heading-font)!important;
  font-style:normal!important;font-weight:600!important;
  letter-spacing:normal!important;text-transform:none!important;
  line-height:1.4!important;text-wrap:balance;overflow-wrap:break-word;
 }
 body :is(.page:not(.admin-page),.translation-document) h1:not(.home-site-title){font-size:var(--h7-heading-1)!important}
 body :is(.page:not(.admin-page),.translation-document) h2{font-size:var(--h7-heading-2)!important}
 body :is(.page:not(.admin-page),.translation-document) h3{font-size:var(--h7-heading-3)!important}
 body :is(.page:not(.admin-page),.translation-document) :is(h4,h5,h6){font-size:1rem!important}
 body :is(.page:not(.admin-page),.translation-document) :is(h1,h2,h3,h4,h5,h6):not(.home-site-title) :is(span,bdi){
  font-family:inherit!important;font-size:inherit!important;font-style:inherit!important;
  font-weight:inherit!important;line-height:inherit!important;letter-spacing:inherit!important;
 }
 body :is(.page:not(.admin-page),.translation-document) :is(h1,h2,h3,h4,h5,h6) [lang=ar]{font-family:'Amiri',Tahoma,serif!important}
 body :is(.page:not(.admin-page),.translation-document):lang(ar) :is(h1,h2,h3,h4,h5,h6):not(.home-site-title){line-height:1.6!important}
 body :is(.page:not(.admin-page),.translation-document) .portal-title{font-size:clamp(1rem,.95rem + .3vw,1.18rem)!important}
 body :is(.page:not(.admin-page),.translation-document) .eyebrow{font-size:.8rem!important}
 body .album-page .album-track h2{font-size:clamp(1.05rem,1rem + .2vw,1.2rem)!important}
 body .album-page .album-occasion-group h2{font-size:clamp(.95rem,.9rem + .2vw,1.05rem)!important}
 body .album-page #album-title .album-name-meaning{font-size:var(--h7-heading-3)!important}
}

/* Public reading surfaces share the same scale, including the standalone translations. */
:is(.page:not(.admin-page), .translation-document) {
  --h7-prose: #e9e5f3;
  --h7-secondary: #cec7de;
  --h7-reading-width: 65ch;
  --h7-section-space: clamp(1.25rem, .85rem + 2vw, 2.75rem);
  --h7-gutter: clamp(1rem, .65rem + 1.6vw, 2rem);
  --h7-edge-glow: inset 0 0 0 1px #c4baff16, 0 0 3px #63deff8c, 0 0 12px #7373ee46;
  --h7-work-glass: radial-gradient(ellipse at 95% 0%, #6551ae22, transparent 60%),
    linear-gradient(145deg, #2c1b43f5, #171328f7 62%, #221731f7);
}
@layer h7-typography {
  :where(.page:not(.admin-page), .translation-document),
  :where(.page:not(.admin-page), .translation-document) :where([lang]) {
    --h7-reading-font: 'DM Sans', Arial, 'Amiri', sans-serif;
    --h7-reading-size: clamp(1rem, .96rem + .25vw, 1.125rem);
    --h7-leading: 1.7;
  }
  :where(.page:not(.admin-page), .translation-document):is(:lang(ar), :lang(ary)),
  :where(.page:not(.admin-page), .translation-document) [lang]:is(:lang(ar), :lang(ary)) {
    --h7-reading-font: 'Amiri', Tahoma, serif;
    --h7-reading-size: clamp(1.15rem, 1.09rem + .32vw, 1.32rem);
    --h7-leading: 1.85;
  }
  /* Resolve headings inside bilingual passages from their own language. */
  body :is(.page:not(.admin-page), .translation-document) :is([lang=fr], [lang=en]) {
    --h7-heading-font: 'DM Sans', Arial, 'Amiri', sans-serif;
  }
  body :is(.page:not(.admin-page), .translation-document) :is([lang=ar], [lang=ary]) {
    --h7-heading-font: 'Amiri', Tahoma, serif;
  }
  body :is(.page:not(.admin-page), .translation-document) :is(h1,h2,h3,h4,h5,h6) bdi[lang]:not([lang=ar]) {
    font-family: var(--h7-heading-font) !important;
  }
  body .home-page .home-work-card h3.song-title {
    font-size: var(--h7-heading-2) !important;
  }
  :is(.page:not(.admin-page), .translation-document) :is(
    .narrative-text p, .work-intro, .work-main > p:not([class]), .album-reading-intro,
    .song-lyrics-text, .reader-translations p, .infini-translations p,
    .manga7-translations p, .l2amirat-translations p,
    .interact-intro, .album-invitation-poem
  ), .legal-document section > p, .translation-document p {
    font-family: var(--h7-reading-font) !important;
    font-size: var(--h7-reading-size) !important;
    line-height: var(--h7-leading) !important;
    letter-spacing: normal !important;
    text-wrap: pretty;
  }
  .page:not(.admin-page) .portal-subtitle {
    font-family: var(--h7-reading-font) !important;
    font-size: .875rem !important;
    line-height: 1.5;
    letter-spacing: normal;
  }
  .page:not(.admin-page) .portal-subtitle:lang(ar) { font-size: 1rem !important; }
}

body .work-site .work-main {
  padding-block: var(--h7-section-space) clamp(2.5rem, 5vw, 4.5rem);
}
body .work-site[data-work-detail] .work-section.narrative-text,
body .work-site .work-main > p:not([class]),
body .legal-document section, main.page.interact:not(.admin-page) > .interact-intro,
.translation-document article {
  max-inline-size: var(--h7-reading-width);
  margin-inline: auto;
}
body .work-site .work-main > p:not([class]) { text-align: center; }
body .work-site[data-work-detail] .narrative-text p {
  max-inline-size: none;
}
body .work-site .work-card .work-card-text {
  padding: var(--h7-gutter);
  gap: clamp(.65rem, .5rem + .5vw, 1rem);
}
body .work-site .work-card .work-card-text > :is(p, .song-title) { margin-block: 0 !important; }
body .legal-document { padding-inline: var(--h7-gutter); }
body .legal-document section { margin-block: var(--h7-section-space); }
.translation-document { padding: var(--h7-section-space) var(--h7-gutter); }
.translation-document article { margin-block: var(--h7-section-space); padding-block-end: 1rem; }

body .home-page #accueil > #demarche-pillars.creative-portals {
  gap: clamp(.75rem, 1.4vw, 1.5rem);
  padding-block: 0;
  margin-block: var(--h7-section-space);
}
body .home-page #accueil > .album-invitation {
  padding-inline: var(--h7-gutter);
  margin-block-start: 0;
}
body .home-page #accueil > .album-invitation .album-invitation-poem {
  max-inline-size: 54ch;
}
@media (min-width: 761px) {
  body .page:not(.admin-page) .site-navigation {
    --desktop-control-height: clamp(48px, 4.1vw, 58px);
    --desktop-control-font: clamp(1rem, .9rem + .35vw, 1.2rem);
  }
}
@media screen and (forced-colors: none) {
  /* The existing signature and banner stay on their original image layers. */
  body:has(:is(.page:not(.admin-page), .translation-document))::after {
    background: radial-gradient(ellipse at 90% 18%, #8792ff0f, transparent 48%),
      linear-gradient(128deg, #17113142, #0d0b257d 58%, #1b103c61);
  }
  body .page:not(.admin-page) .site-navigation header:has(.header-wordmark)::before {
    background: linear-gradient(110deg, #251c37, #20182f 55%, #1a1c36);
  }
  body .page:not(.admin-page) .site-navigation :is(.search-trigger, .mobile-menu summary, .header-languages a),
  body .home-page #demarche-pillars .creative-portal[data-tone] {
    box-shadow: var(--h7-edge-glow) !important;
    text-shadow: none !important;
  }
  body .page:not(.admin-page) .site-navigation :is(.search-trigger, .mobile-menu summary, .header-languages a) {
    border-radius: .65rem;
    font-family: var(--h7-reading-font);
  }
  body .page:not(.admin-page) .site-navigation .header-languages a[aria-current=page] {
    box-shadow: inset 0 -2px #93e9fd, var(--h7-edge-glow) !important;
  }
  body .home-page #demarche-pillars .creative-portal[data-tone][data-open=true],
  body .home-page #demarche-pillars .creative-portal[data-tone]:focus-within,
  body .page:not(.admin-page) .site-navigation :is(.search-trigger, .mobile-menu summary, .header-languages a):is(:hover,:focus-visible) {
    box-shadow: inset 0 0 0 1px #c9eaff66, 0 0 5px #74e2ffbd, 0 0 16px #9876ed66 !important;
  }
  body :is(.work-site .narrative-text, .legal-document section, .translation-document) p,
  body .home-page #accueil > .album-invitation .album-invitation-poem {
    color: var(--h7-prose);
  }
  body .album-page .album-reading-intro,
  body .work-site .work-card-text .small-note { color: var(--h7-secondary); }
  body .work-site .work-main > h1:not(.song-title),
  body main.page.interact:not(.admin-page) > h1 {
    color: #d0e9ff !important;
    -webkit-text-fill-color: currentColor !important;
    background: none !important;
    text-shadow: 0 0 .65rem #94b4ff40 !important;
    -webkit-box-reflect: unset !important;
  }
  body .work-site .work-main > h1:not(.song-title)::after,
  body main.page.interact:not(.admin-page) > h1::after { content: none !important; }
}

@media (max-width: 760px) {
  body .page:not(.admin-page) .site-navigation .header-languages { bottom: 10px !important; }
  body .page:not(.admin-page) .site-navigation .header-languages a {
    min-inline-size: 44px;
    min-block-size: 44px;
    font-size: .875rem;
  }
}
/* Give the three languages their own row when all five targets cannot fit. */
@media (max-width: 389px) {
  body .page:not(.admin-page) .site-navigation .header-languages {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none;
    padding-block: .375rem !important;
    gap: .5rem;
    z-index: 1;
  }
  body .page:not(.admin-page) .site-navigation .header-languages a { flex: 1; }
  body .page:not(.admin-page) .site-navigation .work-search {
    bottom: calc(10px + 44px + .75rem);
  }
}
