/* ============================================================================
   QF chrome — shared header + footer
   A faithful CSS port of the Qatar Foundation Design System's site chrome
   (ui_kits/qf-website/Chrome.jsx: Header, Footer) plus the DS element resets
   (tokens/base.css) and the Button / Tabs / IconButton primitives the chrome
   uses. Load it after qf-tokens.css on every project so the header and footer
   are identical everywhere; content comes from config/qf-chrome.php.

   DS values kept as published: 1180px content width, 24px gutters, square
   corners, 1px hairlines instead of shadow, ink-first colour, calm motion.
   ============================================================================ */

/* ---- DS base (tokens/base.css). :where() keeps specificity at 0 so page and
        component rules always win over the reset. ---- */
.qf-page {
    margin: 0;
    /* PUE page shell (templates/pue-page): column flex so the footer is pinned
       to the bottom of short pages. */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-weight: var(--weight-regular);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    color: var(--qf-ink);
    background: var(--surface-page);
    -webkit-font-smoothing: antialiased;
}
.qf-page *,
.qf-page *::before,
.qf-page *::after { box-sizing: border-box; }
.qf-page :where(h1, h2, h3, h4, h5, h6) {
    margin: 0;
    font-weight: var(--weight-medium);
    line-height: var(--leading-heading);
    color: var(--text-heading);
}
.qf-page :where(p, ul, ol) { margin: 0; }
.qf-page :where(a) {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-standard);
}
.qf-page :where(a):hover { color: var(--text-link-hover); }
.qf-page :where(img, svg) { display: block; max-width: 100%; }
.qf-page ::selection { background: var(--qf-mint); color: var(--qf-ink); }
.qf-page :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.qf-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Container: DS token is 1280px, qf.org.qa runs 1180px in practice ---- */
:root { --qf-content-max: 1180px; }
.qf-shell {
    width: 100%;
    max-width: var(--qf-content-max);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

/* Content area of the PUE page shell (templates/pue-page): the shell container
   plus its 56px / 96px vertical rhythm. */
.qf-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: var(--qf-content-max);
    margin-inline: auto;
    padding: var(--section-y-sm) var(--gutter) var(--section-y);
}

/* ---- Button (components/core/Button) ---- */
.qf-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--space-2);
    padding: 7px 14px;                /* size sm — the size the chrome uses */
    font-family: var(--font-sans);
    font-size: var(--text-caption);
    font-weight: var(--weight-medium);
    line-height: 1.4;
    border-radius: var(--radius-none);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--duration-fast) var(--ease-standard),
                color var(--duration-fast) var(--ease-standard),
                border-color var(--duration-fast) var(--ease-standard);
}
.qf-btn--primary   { background: var(--qf-ink); color: var(--qf-white); border: 1px solid var(--qf-ink); }
.qf-btn--secondary { background: transparent; color: var(--qf-ink); border: 1px solid var(--qf-ink); }
.qf-btn--brand     { background: var(--qf-sidra-green); color: var(--qf-white); border: 1px solid var(--qf-sidra-green); }
.qf-btn--accent    { background: var(--qf-orange); color: var(--qf-white); border: 1px solid var(--qf-orange); }
.qf-btn--ghost     { background: transparent; color: var(--qf-ink); border: 1px solid transparent; }
.qf-page a.qf-btn--primary,
.qf-page a.qf-btn--brand,
.qf-page a.qf-btn--accent   { color: var(--qf-white); }
.qf-page a.qf-btn--secondary,
.qf-page a.qf-btn--ghost    { color: var(--qf-ink); }
.qf-btn--primary:hover   { background: var(--qf-cool-gray-11); border-color: var(--qf-cool-gray-11); }
.qf-page a.qf-btn--secondary:hover { background: var(--qf-ink); color: var(--qf-white); }
.qf-btn--secondary:hover { background: var(--qf-ink); color: var(--qf-white); }
.qf-btn--brand:hover     { background: #02352a; border-color: #02352a; }
.qf-btn--accent:hover    { background: #e85712; border-color: #e85712; }
.qf-btn--ghost:hover     { background: var(--qf-surface-tint); }

/* ---- IconButton (components/core/IconButton) ---- */
.qf-iconbtn {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-none);
    background: transparent;
    color: var(--qf-ink);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-standard);
}
/* DS hovers to --surface-tint; the footer already sits on tint, so hover to
   the page ground there to keep the state visible. */
.qf-iconbtn:hover { background: var(--surface-page); }
.qf-page a.qf-iconbtn:hover { color: var(--qf-ink); }
.qf-iconbtn--circle { border-radius: var(--radius-circle); }
.qf-iconbtn--solid {
    background: var(--qf-ink); border-color: var(--qf-ink); color: var(--qf-white);
}

/* ============================================================================
   Header — sticky, two tiers: brand + actions, then nav tabs + utility row
   ============================================================================ */
.qf-header {
    position: sticky; top: 0; z-index: 30;
    background: var(--surface-page);
}
.qf-header-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-4);
    padding-block: 14px;
}
/* DS Lockup: 40px is the header default, 36px the floor before the Arabic
   strokes close up. Ratio is 4.75:1, so width follows height. */
.qf-header-logo img { height: 40px; width: auto; }
.qf-header-actions { display: flex; align-items: center; gap: 10px; }

.qf-header-bar {
    border-top: var(--border-hairline);
    border-bottom: var(--border-hairline);
}
.qf-header-bar .qf-shell {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-6);
}

/* Tabs (components/navigation/Tabs, underline variant) */
.qf-nav {
    display: flex; align-items: flex-end; gap: 30px;
    margin-bottom: -1px;             /* active underline sits on the bar rule */
    padding-top: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.qf-nav::-webkit-scrollbar { display: none; }
.qf-page .qf-nav a {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding-bottom: 10px;
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color var(--duration-fast) var(--ease-standard),
                border-color var(--duration-fast) var(--ease-standard);
}
.qf-page .qf-nav a:hover { color: var(--qf-ink); }
.qf-page .qf-nav a[aria-current="page"] {
    color: var(--qf-ink);
    font-weight: var(--weight-medium);
    border-bottom-color: var(--qf-ink);
}
.qf-nav a img { height: 18px; width: auto; }

/* Utility row */
.qf-utility {
    display: flex; align-items: center; gap: 14px;
    padding-block: var(--space-2);
    font-size: var(--text-caption);
    color: var(--text-muted);
}
.qf-page .qf-utility a { color: var(--text-muted); }
.qf-page .qf-utility a:hover { color: var(--qf-ink); }
.qf-utility .qf-utility-item { display: inline-flex; align-items: center; gap: 5px; }
.qf-utility .qf-utility-ar { font-family: var(--font-arabic); }

/* ============================================================================
   Footer — tint ground, mission block, link columns, legal bar
   ============================================================================ */
.qf-footer {
    margin-top: var(--space-20);
    background: var(--surface-tint);
}
.qf-footer .qf-shell { padding-block: var(--section-y-sm); }

.qf-footer-top {
    display: flex; gap: var(--space-12);
    padding-bottom: var(--space-10);
    border-bottom: var(--border-hairline);
}
.qf-footer-lockup img { height: 52px; width: auto; }
.qf-footer-mission {
    font-family: var(--font-serif-display);
    font-weight: var(--weight-regular);
    font-size: var(--text-title-3);
    line-height: 1.4;
    max-width: 380px;
}
.qf-mark-mint   { background: var(--qf-mint); color: var(--qf-ink); }
.qf-mark-orange { background: var(--qf-orange); color: var(--qf-white); }
.qf-mark-yellow { background: var(--qf-yellow); color: var(--qf-ink); }
.qf-mark-mint, .qf-mark-orange, .qf-mark-yellow {
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
.qf-footer-quick {
    display: flex; flex-direction: column; gap: 7px;
    padding-inline-start: var(--space-12);
    border-inline-start: var(--border-hairline);
    font-size: var(--text-body-sm);
}
.qf-page .qf-footer-quick a { color: var(--qf-ink); }
.qf-page .qf-footer-quick a:hover { color: var(--text-link-hover); }

.qf-footer-cols {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-10);
    padding-block: 36px;
}
.qf-footer-cols h2 {
    font-family: var(--font-sans);
    font-size: var(--text-body-sm);
    font-weight: var(--weight-medium);
    margin-bottom: 14px;
}
.qf-footer-col-links { display: flex; flex-direction: column; gap: 7px; }
.qf-page .qf-footer-col-links a { font-size: var(--text-caption); color: var(--text-muted); }
.qf-page .qf-footer-col-links a:hover { color: var(--qf-ink); }

.qf-footer-legal {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--space-6);
    padding-top: var(--space-6);
    border-top: var(--border-hairline);
    font-size: var(--text-micro);
    color: var(--text-subtle);
}
.qf-footer-social { display: flex; gap: var(--space-2); }
.qf-footer-social .qf-iconbtn svg { width: 15px; height: 15px; }
.qf-footer-links { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.qf-page .qf-footer-links a { color: var(--text-subtle); }
.qf-page .qf-footer-links a:hover { color: var(--qf-ink); }

/* ============================================================================
   PUE footer (components/chrome/PueFooter) — the short single-tier bar used on
   Pre-University Education pages instead of the full SiteFooter: one Sidra
   green band with the reversed lockup, PUE's links and channels, legal bar.
   ============================================================================ */
.pue-footer {
    margin-top: var(--space-20);
    background: var(--surface-brand);
    color: var(--text-on-dark);
}
.pue-footer-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--space-8);
    padding-block: 44px;
}
.pue-footer-lockup { height: 46px; width: auto; }
.pue-footer-right {
    display: flex; flex-wrap: wrap; align-items: center; gap: 28px;
}
.qf-page .pue-footer-link {
    font-size: var(--text-body);
    letter-spacing: .01em;
    color: var(--text-on-dark);
    border-bottom: 1px solid rgba(255, 255, 255, .45);
    padding-bottom: 2px;
}
.qf-page .pue-footer-link:hover { border-bottom-color: var(--text-on-dark); color: var(--text-on-dark); }
.pue-footer-socials { display: flex; gap: 14px; }
.qf-page .pue-footer-socials a { color: var(--text-on-dark); display: inline-flex; }
.qf-page .pue-footer-socials a:hover { color: var(--accent-editorial); }

.pue-footer-legal { border-top: 1px solid rgba(255, 255, 255, .18); }
.pue-footer-legal .qf-shell {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--space-4);
    padding-block: var(--space-4);
    font-size: var(--text-micro);
    color: rgba(255, 255, 255, .7);
}

/* Producing-unit credit — the one place the system animates type: a slow yellow
   sweep across the unit name, a pulsing dot, and a rule that draws on hover. */
@keyframes pue-credit-sweep { 0% { background-position: 200% 0; } 60%, 100% { background-position: -120% 0; } }
@keyframes pue-credit-pulse { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.35); opacity: 1; } }
.qf-page .pue-credit {
    position: relative;
    display: inline-flex; align-items: center; gap: var(--space-2);
    font-size: var(--text-micro);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .7);
}
.pue-credit .pue-credit-dot {
    width: 5px; height: 5px; flex: 0 0 auto;
    border-radius: var(--radius-circle);
    background: var(--qf-yellow);
    animation: pue-credit-pulse 2.6s ease-in-out infinite;
}
.pue-credit .pue-credit-unit {
    font-weight: var(--weight-medium);
    background: linear-gradient(100deg,
        rgba(255, 255, 255, .72) 0%, rgba(255, 255, 255, .72) 38%,
        var(--qf-yellow) 50%,
        rgba(255, 255, 255, .72) 62%, rgba(255, 255, 255, .72) 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pue-credit-sweep 5.5s ease-in-out infinite;
}
.pue-credit .pue-credit-rule {
    position: absolute; inset-inline: 13px 0; bottom: -3px;
    height: 1px;
    background: var(--qf-yellow);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}
.pue-credit:hover .pue-credit-rule { transform: scaleX(1); }
.pue-credit:hover .pue-credit-unit { animation-duration: 1.6s; }

/* ---- Breakpoints ---- */
@media (max-width: 1000px) {
    .qf-footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .qf-header-top { flex-wrap: wrap; }
    .qf-header-bar .qf-shell { flex-direction: column; align-items: stretch; gap: 0; }
    .qf-utility { flex-wrap: wrap; padding-bottom: var(--space-3); }
    .qf-footer-top { flex-direction: column; gap: var(--space-8); }
    .qf-footer-quick {
        padding-inline-start: 0; border-inline-start: 0;
        padding-top: var(--space-6); border-top: var(--border-hairline);
    }
    .qf-footer-mission { max-width: none; }
}
@media (max-width: 560px) {
    .qf-footer-cols { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
    /* Never below the DS 36px floor for the lockup. */
    .qf-header-logo img { height: 36px; }
    .qf-footer-lockup img { height: 40px; }
}

/* ---- Reduced motion ---- */
@media (max-width: 560px) {
    .pue-footer-bar { gap: var(--space-6); }
    .pue-footer-lockup { height: 38px; }
    .pue-footer-right { gap: var(--space-5); }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .qf-page *, .qf-page *::before, .qf-page *::after {
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
    }
    /* The gradient-clipped credit needs a solid colour once the sweep stops. */
    .pue-credit .pue-credit-unit {
        animation: none;
        background: none;
        color: var(--qf-yellow);
        -webkit-text-fill-color: currentColor;
    }
    .pue-credit .pue-credit-dot { animation: none; }
}
