/* waey.org Global edition: the hub homepage's header, so it is identical on
   every waey.org page. Rules mirror news-v8.css, hub-theme.v4.css,
   country-nav.v1.css, brand-logos.v1.css and mobile-scroll.v1.css in the hub
   (misr.git web/), scoped to the header and guarded against the edition CSS. */
@font-face {
    font-family: "Waey Hub Kufi";
    src: url("/DroidKufiRegular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
html[data-edition="global"] .masthead {
    --line: #e1e7f1;
    --blue: #19487d;
    --muted: #526581;
    --waey-accent: var(--blue);
    --waey-surface: #fff;
    --waey-border: var(--line);
    --hub-section-hover: #edf2f8;
    box-sizing: border-box;
    position: relative;
    z-index: 20;
    display: block;
    margin: 0;
    padding: 0;
    font-family: "Waey Hub Kufi", Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.65;
    text-align: start;
    color: #142b4d;
    background: #fff;
    border-top: 4px solid var(--blue);
    border-bottom: 1px solid var(--line);
}
html[data-edition="global"][data-theme="dark"] .masthead {
    color-scheme: dark;
    --waey-surface: #131d2d;
    --line: #33435a;
    --blue: #a3c7f2;
    --muted: #b0bfd3;
    --hub-section-hover: #22334b;
    color: #e0e8f4;
    background: var(--waey-surface);
}

/* Neutralise the edition stylesheets inside the header. */
html[data-edition="global"] .masthead *,
html[data-edition="global"] .masthead *::before,
html[data-edition="global"] .masthead *::after { box-sizing: border-box; }
html[data-edition="global"] .masthead :is(div, nav, a, span, small, details, summary, form, input, button, img) {
    float: none;
    margin: 0;
    letter-spacing: normal;
    text-transform: none;
    text-shadow: none;
    font-family: inherit;
}
html[data-edition="global"] .masthead :is(a, summary) {
    color: inherit;
    text-decoration: none;
    background: none;
}
html[data-edition="global"] .masthead a:hover { color: var(--blue); }
html[data-edition="global"] .masthead :focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
html[data-edition="global"] .masthead img { max-width: none; border: 0; }

html[data-edition="global"] .masthead .shell { width: min(1140px, calc(100% - 32px)); margin-inline: auto; padding: 0; }
html[data-edition="global"] .masthead .mast { min-height: 76px; display: flex; align-items: center; gap: 18px; }

html[data-edition="global"] .masthead .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-inline-end: auto;
    font-size: 1.2rem;
    line-height: 1.4;
    font-weight: bold;
}
html[data-edition="global"] .masthead .brand img { object-fit: contain; }
html[data-edition="global"] .masthead .brand small { display: block; font-size: .69rem; font-weight: 400; color: var(--muted); }
html[data-edition="global"] .masthead .brand img.waey-brand-logo {
    display: block;
    flex: 0 0 62px;
    width: 62px;
    height: 62px;
    max-width: 62px;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 12px;
}

html[data-edition="global"] .masthead .edition-picker { position: relative; z-index: 10; }
html[data-edition="global"] .masthead .edition-picker :is(summary, a) {
    min-height: 44px;
    padding: 8px 11px;
    display: flex;
    align-items: center;
    gap: 8px;
}
html[data-edition="global"] .masthead .edition-picker summary {
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 8px;
    white-space: nowrap;
    font-size: .79rem;
}
html[data-edition="global"] .masthead .edition-picker summary::after { content: "⌄"; }
html[data-edition="global"] .masthead .edition-picker img { object-fit: contain; }
html[data-edition="global"] .masthead .edition-picker nav {
    position: absolute;
    inset-inline-end: 0;
    background: var(--waey-surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 28px #142b4d25;
    min-width: 172px;
    max-height: min(70vh, 430px);
    overflow: auto;
}
html[data-edition="global"] .masthead .edition-picker nav a { font-size: 1rem; }
html[data-edition="global"] .masthead .edition-picker a:hover { background: #ebf3ff; }

html[data-edition="global"] .masthead .hub-theme-controls { display: flex; gap: 4px; }
html[data-edition="global"] .masthead .hub-theme-controls button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--waey-surface);
    color: inherit;
    cursor: pointer;
    font: 21px/1 Arial, sans-serif;
    box-shadow: none;
}
html[data-edition="global"] .masthead .hub-theme-controls button[aria-pressed="true"] {
    color: var(--blue);
    background: var(--hub-section-hover);
    border-color: var(--blue);
}

html[data-edition="global"] .masthead .mast-search { display: flex; gap: 6px; }
html[data-edition="global"] .masthead .mast-search :is(input, button) {
    min-height: 44px;
    height: auto;
    font: inherit;
    font-size: .8rem;
    line-height: 1.65;
    box-shadow: none;
}
html[data-edition="global"] .masthead .mast-search input {
    width: 154px;
    min-width: 0;
    background: #f5f7fb;
    color: #000;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
}
html[data-edition="global"] .masthead .mast-search button {
    background: #105bd3;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 13px;
    cursor: pointer;
}

html[data-edition="global"] .masthead .topic-nav { display: block; border-top: 1px solid var(--line); }
html[data-edition="global"] .masthead .topic-nav .shell { display: flex; gap: 22px; overflow: auto; scrollbar-width: thin; }
html[data-edition="global"] .masthead .topic-nav a {
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 5px;
    border-bottom: 3px solid transparent;
    font-size: .85rem;
    font-weight: 700;
}
html[data-edition="global"] .masthead .topic-nav a[aria-current] { color: var(--blue); border-color: var(--blue); }
html[data-edition="global"] .masthead .topic-nav a:is(:hover, [aria-current]) { color: var(--blue); background: var(--hub-section-hover); }

html[data-edition="global"] .masthead .waey-country-menu {
    direction: rtl;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    width: min(1140px, calc(100% - 32px));
    margin: auto;
    border-block-start: 1px solid var(--line);
    color: inherit;
    font-size: .82rem;
}
html[data-edition="global"] .masthead .waey-country-links { display: flex; flex: 1; min-width: 0; gap: 8px; overflow: auto; scrollbar-width: none; }
html[data-edition="global"] .masthead .waey-country-menu :is(a, .waey-country-more summary) {
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 44px;
    padding: 0 8px;
    color: inherit;
    white-space: nowrap;
    font-weight: bold;
    cursor: pointer;
}
html[data-edition="global"] .masthead .waey-country-menu :is(a:hover, a[aria-current]) { color: var(--blue); }
html[data-edition="global"] .masthead .waey-country-menu img { object-fit: contain; flex: none; }
html[data-edition="global"] .masthead .waey-country-more[hidden] { display: none; }
html[data-edition="global"] .masthead .waey-country-extra { background: var(--waey-surface); border-color: var(--line); }

html[data-edition="global"][data-theme="dark"] .masthead :is(.mast-search input, .edition-picker a:hover) {
    background: #1d2b40;
    border-color: var(--line);
    color: inherit;
}

@media (max-width: 767px) {
    html[data-edition="global"] .masthead { padding-top: env(safe-area-inset-top, 0px); }
    html[data-edition="global"] .masthead .shell { max-width: 100%; }
}

@media (max-width: 650px) {
    html[data-edition="global"] .masthead .shell { width: calc(100% - 24px); }
    html[data-edition="global"] .masthead .mast {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px;
        padding-block: 7px;
    }
    html[data-edition="global"] .masthead .brand { font-size: .96rem; justify-self: start; }
    html[data-edition="global"] .masthead .brand img.waey-brand-logo { flex-basis: 45px; width: 45px; height: 45px; max-width: 45px; border-radius: 9px; }
    html[data-edition="global"] .masthead .edition-picker { justify-self: end; }
    html[data-edition="global"] .masthead .mast-search { width: 100%; min-width: 0; }
    html[data-edition="global"] .masthead .mast-search input { flex: 1; width: auto; }
    html[data-edition="global"] .masthead .topic-nav .shell { gap: 16px; }
}

@media (max-width: 350px) {
    html[data-edition="global"] .masthead .brand img.waey-brand-logo { flex-basis: 38px; width: 38px; height: 38px; max-width: 38px; border-radius: 8px; }
}
