/* ============================================================
 * NIAMR Home — scoped extras
 *
 * SCOPED STYLING (approved): .niamr-phases and .niamr-ooi only.
 * All other Home sections stay on raw Medolia classes.
 *
 * Palette stays inside the Medolia + spec §10 colors:
 *   navy   #042657
 *   nihr   #005EB8
 *   ruby   #be0c23
 *   light  #F5F7FA
 *   white  #FFFFFF
 *
 * Typography inherits from common-style.css (Albert Sans / Rubik).
 * ============================================================ */


/* ============================================================
   PHASE TIMELINE (.niamr-phases)
   Inspired by the "Timeline for Web Development Projects" slide:
   horizontal spine, alternating up/down phase cards, dot markers,
   short uniform descriptions. Uses Flaticon icons.
   ============================================================ */
.niamr-phases {
    position: relative;
    padding: 40px 0;
}
/* Explicit grid rows: upper card zone / spine zone / lower card zone.
   This is what forces real zig-zag — up-items occupy row 1, down-items
   occupy row 3, markers all sit in row 2. */
.niamr-phases__items {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: minmax(170px, auto) 96px minmax(170px, auto);
    gap: 0;
    position: relative;
}
/* Central horizontal spine — sits in row 2, spans all columns */
.niamr-phases__items::before {
    content: "";
    grid-row: 2;
    grid-column: 1 / -1;
    align-self: center;
    height: 8px;
    background: linear-gradient(to right, #042657 0%, #042657 40%, #005EB8 40%, #005EB8 70%, #be0c23 70%, #be0c23 100%);
    border-radius: 2px;
    z-index: 1;
}
/* Each .niamr-phases__item is `display: contents` so its children (card +
   marker) are placed directly into the grid by row/column rules. */
.niamr-phases__item {
    display: contents;
}

/* Phase content card: number pill, title, short description */
.niamr-phases__card {
    background: #ffffff;
    border: 1px solid rgba(4, 38, 87, 0.08);
    border-radius: 8px;
    padding: 16px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    position: relative;
    max-width: 220px;
    margin: 0 auto;
    text-align: center;
    z-index: 2;
}
.niamr-phases__item--up   > .niamr-phases__card { grid-row: 1; align-self: end;   margin-bottom: 20px; }
.niamr-phases__item--down > .niamr-phases__card { grid-row: 3; align-self: start; margin-top: 20px; }
/* Per-column placement — each item's children share the same column index. */
.niamr-phases__item:nth-child(1) > * { grid-column: 1; }
.niamr-phases__item:nth-child(2) > * { grid-column: 2; }
.niamr-phases__item:nth-child(3) > * { grid-column: 3; }
.niamr-phases__item:nth-child(4) > * { grid-column: 4; }
.niamr-phases__item:nth-child(5) > * { grid-column: 5; }
.niamr-phases__num {
    display: inline-block;
    font-family: "Albert Sans", sans-serif;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: #be0c23;
    margin-bottom: 6px;
}
.niamr-phases__title {
    font-family: "Albert Sans", sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #042657;
    margin: 0 0 8px;
    line-height: 1.25;
}
.niamr-phases__desc {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(4, 38, 87, 0.75);
    margin: 0;
}

/* Connecting dashed line from card to the spine marker */
.niamr-phases__item--up   .niamr-phases__card::after,
.niamr-phases__item--down .niamr-phases__card::before {
    content: "";
    position: absolute;
    left: 50%;
    width: 2px;
    height: 24px;
    background: repeating-linear-gradient(to bottom, rgba(4,38,87,0.25) 0 4px, transparent 4px 8px);
    transform: translateX(-50%);
}
.niamr-phases__item--up   .niamr-phases__card::after  { top: 100%; }
.niamr-phases__item--down .niamr-phases__card::before { bottom: 100%; }

/* Circular icon medallion sitting on the spine (grid row 2) */
.niamr-phases__marker {
    grid-row: 2;
    justify-self: center;
    align-self: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #042657;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #042657;
    font-size: 28px;
    box-shadow: 0 6px 16px rgba(4, 38, 87, 0.15);
    z-index: 3;
}
.niamr-phases__item:nth-child(2) > .niamr-phases__marker,
.niamr-phases__item:nth-child(3) > .niamr-phases__marker { border-color: #005EB8; color: #005EB8; }
.niamr-phases__item:nth-child(4) > .niamr-phases__marker,
.niamr-phases__item:nth-child(5) > .niamr-phases__marker { border-color: #be0c23; color: #be0c23; }


/* Responsive — below lg, swap to a vertical stack with a left spine */
@media (max-width: 991px) {
    .niamr-phases__items {
        grid-template-columns: 80px 1fr;
        grid-template-rows: repeat(5, auto);
        gap: 16px 0;
        padding-left: 0;
        position: relative;
    }
    /* Spine becomes vertical, sitting in column 1 */
    .niamr-phases__items::before {
        grid-row: 1 / -1;
        grid-column: 1;
        align-self: stretch;
        justify-self: center;
        width: 6px; height: auto;
        background: linear-gradient(to bottom, #042657 0%, #042657 40%, #005EB8 40%, #005EB8 70%, #be0c23 70%, #be0c23 100%);
    }
    /* Reset per-column placement from desktop and place each item on its own row */
    .niamr-phases__item:nth-child(n) > * { grid-column: auto; }
    .niamr-phases__item > .niamr-phases__marker { grid-column: 1; justify-self: center; align-self: start; }
    .niamr-phases__item > .niamr-phases__card   { grid-column: 2; align-self: start; text-align: left; margin: 0; max-width: 100%; }
    .niamr-phases__item:nth-child(1) > * { grid-row: 1; }
    .niamr-phases__item:nth-child(2) > * { grid-row: 2; }
    .niamr-phases__item:nth-child(3) > * { grid-row: 3; }
    .niamr-phases__item:nth-child(4) > * { grid-row: 4; }
    .niamr-phases__item:nth-child(5) > * { grid-row: 5; }
    .niamr-phases__item--up   > .niamr-phases__card,
    .niamr-phases__item--down > .niamr-phases__card { margin: 0; }
    .niamr-phases__item--up   .niamr-phases__card::after,
    .niamr-phases__item--down .niamr-phases__card::before { display: none; }
    .niamr-phases__marker { width: 56px; height: 56px; font-size: 22px; }
}


/* ============================================================
   OUTPUTS / OUTCOMES / IMPACT (.niamr-ooi)
   Inspired by the "Essential Phases of Website Development Plan"
   slide: vertical pillars, circular icon medallion on top, title,
   bulleted/paragraph content, big serial number at the bottom.
   3 tiers, color-coded (navy / NIHR blue / One Health green).
   ============================================================ */
.niamr-ooi { margin-top: 40px; }

/* Horizontal cascade with proportional widths: Outputs wide (5fr),
   Outcomes medium (4fr), Impact narrow (3fr). Same height via grid
   stretch. Arrow connectors sit in the gap between pillars. */
.niamr-ooi__grid {
    display: grid;
    grid-template-columns: 5fr 2fr 3fr;   /* 50% / 20% / 30% */
    gap: 24px;
    align-items: stretch;
    position: relative;
}
.niamr-ooi__pillar {
    position: relative;
    background: #ffffff;
    border: 1px solid rgba(4, 38, 87, 0.08);
    border-radius: 12px;
    padding: 0 0 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 460px;
    text-align: center;
}
.niamr-ooi__banner {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f0f4f8;
}
.niamr-ooi__banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.niamr-ooi__head { padding: 24px 24px 0; }
.niamr-ooi__body { padding: 0 24px; }

/* Head: prominent solid-color medallion with white Flaticon icon */
.niamr-ooi__head { margin-bottom: 18px; }
.niamr-ooi__medallion {
    width: 72px; height: 72px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
}
.niamr-ooi__medallion i { display: inline-block; line-height: 1; }
/* Image-variant medallion: larger circular photo frame */
.niamr-ooi__medallion--image {
    width: 120px;
    height: 120px;
    background: transparent !important;
    overflow: hidden;
    border: 4px solid #ffffff;
    box-shadow: 0 6px 20px rgba(4, 38, 87, 0.18);
}
.niamr-ooi__medallion--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.niamr-ooi__title {
    font-family: "Albert Sans", sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #042657;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.niamr-ooi__subtitle {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 6px;
}

/* Body */
.niamr-ooi__body {
    flex: 1;
    text-align: left;
    color: rgba(4, 38, 87, 0.85);
    font-size: 15px;
    line-height: 1.6;
}
.niamr-ooi__body p              { margin: 0 0 12px; }
.niamr-ooi__body p:last-child   { margin-bottom: 0; }
.niamr-ooi__body p.lead         { color: #042657; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; text-align: center; }

/* Proper numbered list — lower-roman markers in the tier color */
.niamr-ooi__list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: ooi-count;
}
.niamr-ooi__list li {
    counter-increment: ooi-count;
    position: relative;
    padding: 10px 0 10px 44px;
    border-top: 1px solid rgba(4, 38, 87, 0.08);
    line-height: 1.5;
}
.niamr-ooi__list li:first-child { border-top: 0; }
.niamr-ooi__list li::before {
    content: counter(ooi-count, lower-roman) ".";
    position: absolute;
    left: 0;
    top: 10px;
    font-family: "Albert Sans", sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: -0.01em;
    min-width: 36px;
    text-transform: lowercase;
}

/* Tier color variants — only the medallion and list markers carry color now */
.niamr-ooi__pillar--outputs  .niamr-ooi__medallion       { background: #be0c23; }
.niamr-ooi__pillar--outputs  .niamr-ooi__list li::before { color: #042657; }

.niamr-ooi__pillar--outcomes .niamr-ooi__medallion       { background: #be0c23; }

.niamr-ooi__pillar--impact   .niamr-ooi__medallion       { background: #be0c23; }
/* Impact tier — slightly larger body text so the final statement lands */
.niamr-ooi__pillar--impact   .niamr-ooi__body p          { font-size: 16px; font-weight: 500; color: #042657; line-height: 1.65; }

@media (max-width: 991px) {
    .niamr-ooi__grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .niamr-ooi__pillar { min-height: auto; }
}


/* ============================================================
   PARTNERS GRID (.niamr-partners)
   Open-ended divider grid — internal vertical + horizontal lines,
   no outer frame. Expects an 8-item collection laid out in a 4×2
   grid at ≥lg, 2×4 at md, 1×8 on mobile.
   ============================================================ */
.niamr-partners {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
.niamr-partners__cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 20px;
    color: inherit;
    text-decoration: none;
    transition: background-color 200ms ease;
    /* internal dividers — bottom + right on every cell, stripped on edges below */
    border-right: 1px solid rgba(4, 38, 87, 0.1);
    border-bottom: 1px solid rgba(4, 38, 87, 0.1);
}
.niamr-partners__cell:hover {
    background: rgba(4, 38, 87, 0.025);
    color: inherit;
    text-decoration: none;
}
/* Open the right edge of the grid — remove right border on last column */
.niamr-partners__cell:nth-child(4n) { border-right: 0; }
/* Open the bottom edge of the grid — remove bottom border on last row (items 5-8) */
.niamr-partners__cell:nth-child(n+5) { border-bottom: 0; }

.niamr-partners__logo {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.niamr-partners__logo img {
    max-height: 70px;
    max-width: 180px;
    width: auto;
    object-fit: contain;
}
.niamr-partners__name {
    font-size: 15px;
    font-weight: 700;
    color: #042657;
    margin: 0 0 10px;
}
.niamr-partners__description {
    font-size: 13px;
    line-height: 1.55;
    color: rgba(4, 38, 87, 0.75);
    margin: 0;
    max-width: 240px;
}

/* Tablet — 2 columns. Reset per-cell borders then reapply internal dividers. */
@media (max-width: 991px) {
    .niamr-partners { grid-template-columns: repeat(2, 1fr); }
    .niamr-partners__cell {
        border-right: 1px solid rgba(4, 38, 87, 0.1);
        border-bottom: 1px solid rgba(4, 38, 87, 0.1);
    }
    .niamr-partners__cell:nth-child(2n)            { border-right: 0; }
    .niamr-partners__cell:nth-last-child(-n+2)     { border-bottom: 0; }
}

/* Mobile — single column. Horizontal dividers only. */
@media (max-width: 575px) {
    .niamr-partners { grid-template-columns: 1fr; }
    .niamr-partners__cell {
        border-right: 0 !important;
        border-bottom: 1px solid rgba(4, 38, 87, 0.1);
    }
    .niamr-partners__cell:last-child { border-bottom: 0; }
}


/* ============================================================
   HOME ICON OVERRIDES — ruby red on all home-screen icons
   Loaded last so these win the cascade over home-one.css.
   ============================================================ */

/* AMR challenge cards — solid circle */
.medolia-service-box .icon {
    background-color: #be0c23;
    color: #ffffff;
}

/* Left-icon-box sections (Insights, Engagement, Outputs, Contact) */
.medolia-left-icon-box .icon,
.medolia-left-icon-box.bg-one .icon,
.medolia-left-icon-box.bg-two .icon {
    background-color: rgba(190, 12, 35, 0.10);
    color: #be0c23;
}
