/* ==========================================================================
   Sustainable Development Goals (archive-nso_sdg.php, single-nso_sdg.php)
   Builds on jobs.css (breadcrumb, header, layout). Goal colours come from
   inc/sdgs.php through the --sdg-color custom property.
   ========================================================================== */

.abp-sdgs {
    --sdg-font: 'Oswald', 'Arial Narrow', 'Roboto Condensed', sans-serif;
}

/* ── Goal grid ──────────────────────────────────────────────────────────── */
.abp-sdg-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
}
.abp-sdg-tile {
    margin: 0;
    aspect-ratio: 1 / 1;
    min-width: 0;
}
.abp-sdg-tile__link {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 9% 9% 10%;
    box-sizing: border-box;
    background: var(--sdg-color);
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
a.abp-sdg-tile__link:hover,
a.abp-sdg-tile__link:focus-visible {
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    filter: brightness(1.05);
    z-index: 1;
}
a.abp-sdg-tile__link:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 2px;
}
.abp-sdg-tile__head {
    display: flex;
    align-items: flex-start;
    gap: 6%;
}
.abp-sdg-tile__num {
    font-family: var(--sdg-font);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.6vw, 3.4rem);
    line-height: 0.9;
}
.abp-sdg-tile__title {
    padding-top: 2%;
    font-family: var(--sdg-font);
    font-weight: 600;
    font-size: clamp(0.72rem, 1.3vw, 1.2rem);
    line-height: 1.12;
    text-transform: uppercase;
    letter-spacing: 0.01em;
}
.abp-sdg-tile__icon {
    margin: auto auto 0;
    font-size: clamp(2.2rem, 5.2vw, 5rem);
    line-height: 1;
}

/* Official UN icon: shown as-is, filling the tile (no padding/overlay) */
.abp-sdg-tile--official .abp-sdg-tile__link {
    padding: 0;
}
.abp-sdg-tile__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.abp-sdg-hero__official {
    flex: 0 0 auto;
    width: 120px;
    height: 120px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.abp-sdg-strip a.has-icon {
    padding: 0;
    overflow: hidden;
}
.abp-sdg-strip a.has-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* First tile: 2030 Agenda */
.abp-sdg-tile--intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10%;
    padding: 8%;
    box-sizing: border-box;
    background: #fff;
    border: 3px solid #e9ecef;
    text-align: center;
}
.abp-sdg-wheel {
    flex: 0 0 auto;
    width: 36%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: conic-gradient(
        #E5243B 0 5.88%, #DDA63A 0 11.76%, #4C9F38 0 17.65%, #C5192D 0 23.53%,
        #FF3A21 0 29.41%, #26BDE2 0 35.29%, #FCC30B 0 41.18%, #A21942 0 47.06%,
        #FD6925 0 52.94%, #DD1367 0 58.82%, #FD9D24 0 64.71%, #BF8B2E 0 70.59%,
        #3F7E44 0 76.47%, #0A97D9 0 82.35%, #56C02B 0 88.24%, #00689D 0 94.12%,
        #19486A 0 100%
    );
    -webkit-mask: radial-gradient(circle, transparent 52%, #000 53%);
            mask: radial-gradient(circle, transparent 52%, #000 53%);
}
.abp-sdg-tile__intro-text {
    font-size: clamp(0.62rem, 1vw, 0.9rem);
    line-height: 1.35;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5f6b76;
}

/* ── Single goal ────────────────────────────────────────────────────────── */
.abp-sdg-single .abp-sdg-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--sdg-color) 0%, color-mix(in srgb, var(--sdg-color) 72%, #000) 100%);
}
.abp-sdg-hero .abp-jobs-hero__inner {
    position: relative;
}
.abp-sdg-hero__badge span {
    font-family: var(--sdg-font);
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
}
.abp-sdg-hero .abp-jobs-hero__text {
    position: relative;
    z-index: 1;
}
.abp-sdg-hero .abp-jobs-hero__text > p:last-child {
    max-width: 760px;
}
/* Large faint goal icon on the right of the header */
.abp-sdg-hero__art {
    position: absolute;
    right: 64px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 150px;
    color: rgba(255, 255, 255, 0.14);
    pointer-events: none;
}

.abp-sdg-main {
    min-width: 0;
}
.abp-sdg-card {
    padding: 28px 32px;
    background: #fff;
    border: 1px solid var(--jobs-border);
    border-top: 4px solid var(--sdg-color);
    border-radius: var(--jobs-radius);
    box-shadow: var(--jobs-shadow);
    color: var(--jobs-text-mid);
    font-size: 1rem;
    line-height: 1.7;
}
.abp-sdg-content > :first-child { margin-top: 0; }
.abp-sdg-content > :last-child { margin-bottom: 0; }
.abp-sdg-content p { margin: 0 0 1em; }
.abp-sdg-content strong { color: var(--jobs-text); }
.abp-sdg-content a { color: var(--jobs-primary-dark); }
.abp-sdg-content h2,
.abp-sdg-content h3,
.abp-sdg-content h4 {
    margin: 1.6em 0 0.6em;
    padding-bottom: 8px;
    border-bottom: 2px solid color-mix(in srgb, var(--sdg-color) 18%, #fff);
    color: var(--jobs-text);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}
.abp-sdg-content ul,
.abp-sdg-content ol { margin: 0 0 1em; padding-left: 1.4em; }
.abp-sdg-content li { margin-bottom: 6px; }
.abp-sdg-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1em;
    font-size: 0.95rem;
}
.abp-sdg-content th,
.abp-sdg-content td {
    padding: 9px 12px;
    border: 1px solid var(--jobs-border);
    text-align: left;
    vertical-align: top;
}
.abp-sdg-content th {
    background: color-mix(in srgb, var(--sdg-color) 10%, #fff);
    color: var(--jobs-text);
}
.abp-sdg-empty {
    text-align: center;
    padding: 48px 24px;
}
.abp-sdg-empty i {
    display: block;
    margin-bottom: 12px;
    font-size: 32px;
    color: var(--sdg-color);
}
.abp-sdg-empty p {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--jobs-text);
}
.abp-sdg-empty span {
    color: var(--jobs-text-light);
    font-size: 0.95rem;
}

/* Sidebar */
.abp-sdg-single .abp-job-summary {
    border-top: 4px solid var(--sdg-color);
}
.abp-sdg-single .abp-sdg-btn {
    margin-bottom: 16px;
    background: var(--sdg-color);
}
.abp-sdg-single .abp-sdg-btn:hover,
.abp-sdg-single .abp-sdg-btn:focus {
    background: color-mix(in srgb, var(--sdg-color) 80%, #000);
}
.abp-sdg-pager {
    display: grid;
    gap: 8px;
}
.abp-sdg-pager a {
    display: block;
    padding: 10px 12px;
    border: 1px solid var(--jobs-border);
    border-radius: 10px;
    color: var(--jobs-text);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.abp-sdg-pager a span {
    display: block;
    margin-bottom: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--jobs-text-light);
}
.abp-sdg-pager a:hover,
.abp-sdg-pager a:focus {
    border-color: var(--jobs-primary);
    background: #f4fbfa;
}
.abp-sdg-pager__next {
    text-align: right;
}

/* Goal with no text or indicators yet: no empty column; the goal box becomes
   a full-width row (title | previous | next | all goals). */
.abp-sdg-layout--nav {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 32px;
}
.abp-sdg-layout--nav .abp-job-aside {
    position: static;
}
.abp-sdg-layout--nav .abp-job-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px 24px;
}
.abp-sdg-layout--nav .abp-job-summary > h2 {
    margin: 0;
}
.abp-sdg-layout--nav .abp-sdg-pager {
    grid-column: 2 / 4;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* Goal 1 / Goal 17 have only one neighbour: keep "next" on the right */
.abp-sdg-layout--nav .abp-sdg-pager__next:only-child {
    grid-column: 2;
}
.abp-sdg-layout--nav .abp-job-back {
    margin: 0;
    white-space: nowrap;
}
@media (max-width: 768px) {
    .abp-sdg-layout--nav .abp-job-summary {
        grid-template-columns: minmax(0, 1fr);
    }
    .abp-sdg-layout--nav .abp-sdg-pager {
        grid-column: auto;
        grid-template-columns: minmax(0, 1fr);
    }
    .abp-sdg-layout--nav .abp-sdg-pager__next:only-child {
        grid-column: auto;
    }
}

/* Strip of all 17 goals */
.abp-sdg-strip-wrap {
    padding-top: 0;
}
.abp-sdg-strip {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(17, minmax(0, 1fr));
    gap: 4px;
}
.abp-sdg-strip a {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: var(--sdg-color);
    color: #fff;
    font-family: var(--sdg-font);
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    opacity: 0.55;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.abp-sdg-strip a:hover,
.abp-sdg-strip a:focus-visible,
.abp-sdg-strip a[aria-current="page"] {
    opacity: 1;
    color: #fff;
}
.abp-sdg-strip a[aria-current="page"] {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

/* ── SDSN ratings and trends ───────────────────────────────────────────── */
.abp-sdgs {
    --rate-green:  #1e8a45;
    --rate-yellow: #e0b100;
    --rate-orange: #ec7a1c;
    --rate-red:    #d32f3c;
    --rate-grey:   #9aa5b1;
}
.abp-sdg-rating,
.abp-sdg-trend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--jobs-text-mid);
}
.abp-sdg-rating__dot {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--rate-grey);
}
.abp-sdg-rating--green  .abp-sdg-rating__dot { background: var(--rate-green); }
.abp-sdg-rating--yellow .abp-sdg-rating__dot { background: var(--rate-yellow); }
.abp-sdg-rating--orange .abp-sdg-rating__dot { background: var(--rate-orange); }
.abp-sdg-rating--red    .abp-sdg-rating__dot { background: var(--rate-red); }
.abp-sdg-trend__arrow {
    flex: 0 0 auto;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
}
.abp-sdg-trend--up       .abp-sdg-trend__arrow { color: var(--rate-green); }
.abp-sdg-trend--moderate .abp-sdg-trend__arrow { color: var(--rate-yellow); }
.abp-sdg-trend--flat     .abp-sdg-trend__arrow { color: var(--rate-orange); }
.abp-sdg-trend--down     .abp-sdg-trend__arrow { color: var(--rate-red); }
.abp-sdg-trend--none { font-weight: 400; color: var(--jobs-text-light); }

/* Source line (credit required by the CC BY-NC-ND licence) */
.abp-sdg-source {
    margin: 16px 0 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--jobs-text-light);
}
.abp-sdg-source a {
    color: var(--jobs-primary-dark);
}

/* ── Dashboard on the SDGs page ────────────────────────────────────────── */
.abp-sdg-dashboard {
    margin-top: 40px;
    padding: 28px 32px;
    background: #fff;
    border: 1px solid var(--jobs-border);
    border-radius: var(--jobs-radius);
    box-shadow: var(--jobs-shadow);
}
.abp-sdg-dashboard__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 32px;
    margin-bottom: 20px;
}
.abp-sdg-dashboard__head h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--jobs-text);
}
.abp-sdg-dashboard__head p {
    margin: 0;
    max-width: 640px;
    color: var(--jobs-text-mid);
    line-height: 1.6;
}
.abp-sdg-score {
    display: flex;
    gap: 12px;
    margin: 0;
}
.abp-sdg-score > div {
    min-width: 130px;
    padding: 12px 18px;
    border-radius: 10px;
    background: #e8f5f4;
    text-align: center;
}
.abp-sdg-score dt {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--jobs-primary-dark);
}
.abp-sdg-score dd {
    margin: 2px 0 0;
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--jobs-text);
}
.abp-sdg-dash-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}
.abp-sdg-dash-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--jobs-border);
    border-left: 4px solid var(--sdg-color);
    border-radius: 10px;
}
.abp-sdg-dash-list__num {
    flex: 0 0 34px;
    height: 34px;
    border-radius: 6px;
    background: var(--sdg-color);
    color: #fff;
    font-family: var(--sdg-font);
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.abp-sdg-dash-list__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.abp-sdg-dash-list__body > a,
.abp-sdg-dash-list__body > strong {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--jobs-text);
    text-decoration: none;
}
.abp-sdg-dash-list__body > a:hover,
.abp-sdg-dash-list__body > a:focus {
    color: var(--jobs-primary-dark);
    text-decoration: underline;
}
.abp-sdg-dash-list__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

/* ── Indicator table on goal pages ─────────────────────────────────────── */
.abp-sdg-main {
    display: grid;
    gap: 24px;
}
.abp-sdg-indicators h2 {
    margin: 0 0 4px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--jobs-text);
}
.abp-sdg-indicators__intro {
    margin: 0 0 16px;
    font-size: 0.92rem;
    color: var(--jobs-text-light);
}
.abp-sdg-table-wrap {
    overflow-x: auto;
}
.abp-sdg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.abp-sdg-table th,
.abp-sdg-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #eef1f4;
    text-align: left;
    vertical-align: top;
}
.abp-sdg-table thead th {
    padding-top: 0;
    border-bottom: 2px solid color-mix(in srgb, var(--sdg-color) 35%, #fff);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--jobs-text-light);
    white-space: nowrap;
}
.abp-sdg-table tbody th {
    font-weight: 600;
    color: var(--jobs-text);
    min-width: 220px;
}
.abp-sdg-table__src {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--jobs-text-light);
}
.abp-sdg-table .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.abp-sdg-table td.num:first-of-type {
    font-size: 1rem;
    font-weight: 700;
    color: var(--jobs-text);
}
.abp-sdg-table tbody tr:last-child th,
.abp-sdg-table tbody tr:last-child td {
    border-bottom: 0;
}
.abp-sdg-na {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--jobs-text-light);
}

/* Goal rating in the sidebar */
.abp-sdg-goal-status {
    margin: 0 0 16px;
}
.abp-sdg-goal-status > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid #eef1f4;
}
.abp-sdg-goal-status dt {
    font-size: 0.8rem;
    color: var(--jobs-text-light);
}
.abp-sdg-goal-status dd {
    margin: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .abp-sdg-dashboard { padding: 22px 18px; }
    .abp-sdg-score { width: 100%; }
    .abp-sdg-score > div { flex: 1 1 0; min-width: 0; }
    .abp-sdg-dash-list { grid-template-columns: 1fr; }
    /* Indicator table → one card per indicator */
    .abp-sdg-table thead { display: none; }
    .abp-sdg-table,
    .abp-sdg-table tbody,
    .abp-sdg-table tr,
    .abp-sdg-table th,
    .abp-sdg-table td { display: block; width: 100%; box-sizing: border-box; }
    .abp-sdg-table tr {
        padding: 12px 0;
        border-bottom: 1px solid #eef1f4;
    }
    .abp-sdg-table tbody tr:last-child { border-bottom: 0; }
    .abp-sdg-table th,
    .abp-sdg-table td { padding: 3px 0; border: 0; min-width: 0; }
    .abp-sdg-table .num { text-align: left; }
    .abp-sdg-table td::before {
        content: attr(data-label) ": ";
        display: inline-block;
        min-width: 64px;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--jobs-text-light);
    }
}
@media (max-width: 1100px) {
    .abp-sdg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .abp-sdg-tile__num   { font-size: clamp(1.8rem, 5vw, 3rem); }
    .abp-sdg-tile__title { font-size: clamp(0.72rem, 1.8vw, 1.05rem); }
    .abp-sdg-tile__icon  { font-size: clamp(2.2rem, 7vw, 4.4rem); }
    .abp-sdg-tile__intro-text { font-size: clamp(0.62rem, 1.4vw, 0.85rem); }
    .abp-sdg-hero__art { right: 32px; font-size: 120px; }
    .abp-sdg-strip { grid-template-columns: repeat(9, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .abp-sdg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
    .abp-sdg-tile__num   { font-size: clamp(1.6rem, 7vw, 2.6rem); }
    .abp-sdg-tile__title { font-size: clamp(0.62rem, 2.6vw, 0.95rem); }
    .abp-sdg-tile__icon  { font-size: clamp(1.8rem, 10vw, 3.6rem); }
    .abp-sdg-tile__intro-text { font-size: clamp(0.5rem, 2vw, 0.75rem); }
    .abp-sdg-hero__art { display: none; }
    .abp-sdg-hero__badge span { font-size: 28px; }
    .abp-sdg-hero__official { width: 72px; height: 72px; }
    .abp-sdg-card { padding: 22px 18px; }
    .abp-sdg-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
    .abp-sdg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .abp-sdg-tile__num   { font-size: 2.2rem; }
    .abp-sdg-tile__title { font-size: 0.85rem; }
    .abp-sdg-tile__icon  { font-size: 3.2rem; }
    .abp-sdg-tile__intro-text { font-size: 0.68rem; }
}
@media (prefers-reduced-motion: reduce) {
    .abp-sdg-tile__link,
    .abp-sdg-strip a { transition: none; }
    a.abp-sdg-tile__link:hover,
    .abp-sdg-strip a[aria-current="page"] { transform: none; }
}
