/*
 * Partner landing pages (/partners-details/{id}).
 *
 * The page these replace was eleven hand-written landing pages in one file,
 * 968 lines, selected by `$data->id`. Its surfaces were navy while its text was
 * written for a light ground — 21 failures on one page, 40 on another, the H1
 * among them — and its programme lists were typed out by hand, 104 slugs of
 * which 30 led nowhere.
 *
 * This file styles one page that serves all twelve, in the same card language
 * as /partners: white plates for logos, a uniform grid, one call to action.
 * Logical properties throughout, so the Arabic edition needs no mirrored rules.
 */

/* ============================================================== layout === */

.pd-hero,
.pd-section,
.pd-cta { padding-block: clamp(40px, 6vw, 80px); }

.pd-section { background-color: var(--sc-paper); }
.pd-section--tint { background-color: var(--sc-paper-deep); }

/* ================================================================ hero === */

.pd-hero {
    background-color: var(--sc-ink);
    background-image: var(--sc-pattern);
    background-size: 480px auto;
    color: var(--sc-paper);
}

.pd-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: var(--t-xs);
    margin-block-end: var(--s-5);
    color: color-mix(in srgb, var(--sc-paper) 60%, transparent);
}

.pd-crumbs a { color: color-mix(in srgb, var(--sc-paper) 78%, transparent); text-decoration: none; }
.pd-crumbs a:hover { color: var(--sc-accent); }

.pd-hero-row {
    display: flex;
    align-items: center;
    gap: clamp(20px, 4vw, 40px);
    flex-wrap: wrap;
}

/* The logo plate, white, as on the partners page. */
.pd-plate {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    inline-size: 184px;
    block-size: 132px;
    padding: var(--s-3) var(--s-4);
    background: #fff;
    border-radius: var(--r-card);
}

.pd-plate img {
    max-inline-size: 100%;
    max-block-size: 88px;
    inline-size: auto;
    block-size: auto;
    object-fit: contain;
}

.pd-plate-mark {
    font-family: var(--sc-font-display);
    font-size: 40px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--sc-ink);
}

.pd-hero-text { flex: 1 1 320px; min-inline-size: 0; }

.pd-eyebrow {
    font-family: var(--sc-font-display);
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--sc-accent);
    margin: 0 0 var(--s-2);
}

/* Arabic has no letter case, and tracking breaks its joins. */
[dir="rtl"] .pd-eyebrow { letter-spacing: normal; text-transform: none; }

.pd-title {
    font-family: var(--sc-font-display);
    font-size: clamp(26px, 4vw, 44px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--sc-paper);
    margin: 0 0 var(--s-3);
    text-wrap: balance;
}

.pd-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px var(--s-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.pd-facts li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--t-sm);
    color: color-mix(in srgb, var(--sc-paper) 78%, transparent);
}

.pd-facts svg { inline-size: 17px; block-size: 17px; flex: 0 0 auto; color: var(--sc-accent); }

/* Gold on a number — one of the four things the accent is allowed to be. */
.pd-count {
    font-family: var(--sc-font-display);
    font-size: var(--t-lg);
    font-weight: 700;
    color: var(--sc-accent);
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: isolate;
}

.pd-note {
    max-inline-size: 76ch;
    margin: var(--s-5) 0 0;
    padding-block-start: var(--s-4);
    border-block-start: 1px solid color-mix(in srgb, var(--sc-paper) 18%, transparent);
    font-size: var(--t-sm);
    line-height: 1.8;
    color: color-mix(in srgb, var(--sc-paper) 74%, transparent);
}

/* =============================================================== facts === */

.pd-fact-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--s-4);
}

@media (max-width: 991px) { .pd-fact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) { .pd-fact-grid { grid-template-columns: 1fr; } }

.pd-fact {
    display: flex;
    flex-direction: column;
    padding: var(--s-4);
    background: #fff;
    border: 1px solid var(--sc-line);
    border-radius: var(--r-card);
}

.pd-fact-title {
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sc-muted);
    margin: 0 0 var(--s-2);
}

[dir="rtl"] .pd-fact-title { letter-spacing: normal; text-transform: none; }

.pd-fact-body {
    margin: 0;
    font-size: var(--t-sm);
    line-height: 1.7;
    color: var(--sc-ink);
}

.pd-fact-link { color: var(--sc-accent-deep); word-break: break-word; }

.pd-fact--cta .pd-btn { margin-block-start: auto; }
.pd-fact--cta .pd-fact-body { margin-block-end: var(--s-3); color: var(--sc-muted); }

/* =============================================================== about === */

.pd-h2 {
    font-family: var(--sc-font-display);
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 700;
    line-height: 1.25;
    color: var(--sc-ink);
    margin: 0 0 var(--s-3);
}

.pd-h2::after {
    content: "";
    display: block;
    inline-size: 56px;
    block-size: 2px;
    margin-block-start: var(--s-3);
    background: var(--sc-accent);
}

.pd-sub {
    font-size: var(--t-base);
    line-height: 1.8;
    color: var(--sc-muted);
    max-inline-size: 76ch;
    margin: 0;
}

.pd-head { margin-block-end: var(--s-5); }

.pd-about { max-inline-size: 76ch; }

.pd-prose { font-size: var(--t-base); line-height: 1.9; color: var(--sc-muted); }
.pd-prose p { margin-block-end: var(--s-3); }
.pd-prose h2, .pd-prose h3, .pd-prose h4 { color: var(--sc-ink); font-weight: 700; margin-block: var(--s-4) var(--s-2); }
.pd-prose a { color: var(--sc-accent-deep); }
.pd-prose ul, .pd-prose ol { padding-inline-start: 1.25em; margin-block-end: var(--s-3); }
.pd-prose li { margin-block-end: 6px; }

/* ================================================================ cta  === */

.pd-cta {
    background-color: var(--sc-ink-deep);
    background-image: var(--sc-pattern);
    background-size: 480px auto;
    text-align: center;
}

.pd-cta-title {
    font-family: var(--sc-font-display);
    font-size: clamp(22px, 3.2vw, 34px);
    font-weight: 700;
    color: var(--sc-paper);
    margin: 0 0 var(--s-3);
}

.pd-cta-lead {
    max-inline-size: 60ch;
    margin: 0 auto var(--s-5);
    font-size: var(--t-base);
    line-height: 1.8;
    color: color-mix(in srgb, var(--sc-paper) 82%, transparent);
}

.pd-empty { text-align: center; }
.pd-empty .pd-h2::after { margin-inline: auto; }
.pd-empty .pd-sub { margin-inline: auto; }

.pd-more {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s-3);
    margin-block-start: var(--s-5);
}

/* ============================================================= buttons === */

/* Field and label declared together, so they can never disagree — the fault
   that made identical-looking buttons readable on one page and blank on the
   next. 48px tall, past the 44px minimum. */
.pd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-block-size: 48px;
    padding-inline: 26px;
    border-radius: var(--r-pill);
    font-size: var(--t-sm);
    font-weight: 700;
    text-decoration: none;
    transition: transform .2s ease, background-color .2s ease, border-color .2s ease;
}

.pd-btn:hover { transform: translateY(-2px); }
.pd-btn:focus-visible { outline: 3px solid var(--sc-accent); outline-offset: 3px; }

.pd-section .pd-btn--primary { background: var(--sc-ink); color: var(--sc-paper); border: 1px solid var(--sc-ink); }
.pd-section .pd-btn--primary:hover { background: var(--sc-ink-mid); border-color: var(--sc-accent); }

.pd-cta .pd-btn--primary,
.pd-hero .pd-btn--primary { background: var(--sc-paper); color: var(--sc-ink); border: 1px solid var(--sc-paper); }

.pd-section .pd-btn--ghost { background: transparent; color: var(--sc-ink); border: 1px solid var(--sc-line); }
.pd-section .pd-btn--ghost:hover { border-color: var(--sc-accent); }

.pd-cta .pd-btn--ghost {
    background: transparent;
    color: var(--sc-paper);
    border: 1px solid color-mix(in srgb, var(--sc-paper) 42%, transparent);
}
.pd-cta .pd-btn--ghost:hover { border-color: var(--sc-accent); }

/* ========================================================== overrides === */

/* The theme paints every p/span/a cream under .active-dark-mode. Each light
   surface here has to name its own ground, or its text goes invisible — the
   fault this whole page was suffering from. */
/* `$data->address` is stored as HTML and arrives wrapped in its own <p>, so
   naming `.pd-fact-body` reached the parent and missed the text inside it. */
html body.active-dark-mode .pd-section .pd-h2,
html body.active-dark-mode .pd-fact .pd-fact-body,
html body.active-dark-mode .pd-fact .pd-fact-body *,
html body.active-dark-mode .pd-section .pd-btn--ghost { color: var(--sc-ink) !important; }

html body.active-dark-mode .pd-section .pd-sub,
html body.active-dark-mode .pd-prose,
html body.active-dark-mode .pd-prose p,
html body.active-dark-mode .pd-prose li,
html body.active-dark-mode .pd-fact .pd-fact-title,
html body.active-dark-mode .pd-fact--cta .pd-fact-body { color: var(--sc-muted) !important; }

html body.active-dark-mode .pd-prose h2,
html body.active-dark-mode .pd-prose h3,
html body.active-dark-mode .pd-prose h4 { color: var(--sc-ink) !important; }

html body.active-dark-mode .pd-prose a,
html body.active-dark-mode .pd-fact-link { color: var(--sc-accent-deep) !important; }

html body.active-dark-mode .pd-hero .pd-title,
html body.active-dark-mode .pd-cta .pd-cta-title { color: var(--sc-paper) !important; }

html body.active-dark-mode .pd-section .pd-btn--primary,
html body.active-dark-mode .pd-cta .pd-btn--ghost { color: var(--sc-paper) !important; }

html body.active-dark-mode .pd-cta .pd-btn--primary { color: var(--sc-ink) !important; }

html body.active-dark-mode .pd-plate .pd-plate-mark { color: var(--sc-ink) !important; }

@media (prefers-reduced-motion: reduce) {
    .pd-btn { transition: none !important; }
    .pd-btn:hover { transform: none !important; }
}

/* ============================================= the progression route === */

/* Two stages awarded by two different bodies. The numbers are the only gold on
   this block — a number is one of the four things the accent is allowed to be —
   and the rule between the steps is the other.
   An <ol>, because the order is the whole meaning. */

.pd-route {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: none;
    max-inline-size: 76ch;
}

.pd-step {
    display: flex;
    align-items: flex-start;
    gap: var(--s-4);
    padding-block: var(--s-4);
    position: relative;
}

/* The connector runs from one number to the next, so the eye travels the route
   rather than reading two unrelated cards. Drawn on the inline-start edge, which
   mirrors itself in Arabic without a second rule. */
.pd-step:not(:last-child)::before {
    content: "";
    position: absolute;
    inset-block: calc(var(--s-4) + 42px) calc(var(--s-4) * -1);
    inset-inline-start: 20px;
    inline-size: 2px;
    background: linear-gradient(180deg, var(--sc-accent), color-mix(in srgb, var(--sc-accent) 25%, transparent));
}

.pd-step-num {
    flex: 0 0 42px;
    inline-size: 42px;
    block-size: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--sc-ink);
    color: var(--sc-accent);
    font-family: var(--sc-font-display);
    font-size: var(--t-lg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    position: relative;
    z-index: 1;
}

.pd-step-body { display: flex; flex-direction: column; gap: 4px; min-inline-size: 0; }

/* Who awards this stage — the point of the whole block, so it leads. */
.pd-step-awarder {
    font-size: var(--t-xs);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sc-accent-deep);
}

[dir="rtl"] .pd-step-awarder { letter-spacing: normal; text-transform: none; }

.pd-step-title {
    font-family: var(--sc-font-display);
    font-size: var(--t-lg);
    font-weight: 700;
    line-height: 1.35;
    color: var(--sc-ink);
    text-decoration: none;
    text-wrap: balance;
}

.pd-step-title:hover { color: var(--sc-accent-deep); text-decoration: underline; text-underline-offset: .2em; }

.pd-step-role { font-size: var(--t-sm); line-height: 1.7; color: var(--sc-muted); }

.pd-route-note {
    max-inline-size: 76ch;
    margin: var(--s-4) 0 0;
    padding-block-start: var(--s-3);
    border-block-start: 1px solid var(--sc-line);
    font-size: var(--t-sm);
    line-height: 1.8;
    color: var(--sc-muted);
}

/* The cream ground again: every one of these has to name it. */
html body.active-dark-mode .pd-step-title { color: var(--sc-ink) !important; }
html body.active-dark-mode .pd-step-role,
html body.active-dark-mode .pd-route-note { color: var(--sc-muted) !important; }
html body.active-dark-mode .pd-step-awarder { color: var(--sc-accent-deep) !important; }
html body.active-dark-mode .pd-step-num { color: var(--sc-accent) !important; }

@media (max-width: 575px) {
    .pd-step { gap: var(--s-3); }
    .pd-step:not(:last-child)::before { inset-inline-start: 17px; }
    .pd-step-num { flex-basis: 36px; inline-size: 36px; block-size: 36px; font-size: var(--t-base); }
}
