/* ===== Specialties page ===== */
.rp-spec-page {
    padding: 20px 0 120px;
    background: #F3F3F3;
}

/* Hero — side margins match .richmond-cta-section (40 / 20 / 10 across breakpoints) */
.rp-spec-hero {
    padding: 0 40px;
}
.rp-spec-hero__inner {
    position: relative;
    height: 322px;
    border-radius: 38px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 0 0 1px #ffffff,
        inset 0 0 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}
.rp-spec-hero__title {
    position: absolute;
    left: 111px;
    top: 77px;
    max-width: 497px;
    margin: 0;
    color: #1D283A;
    font-family: 'Proxima Nova', sans-serif;
    font-weight: 600;
    font-size: 78px;
    line-height: 1.08;
    text-transform: uppercase;
    letter-spacing: 0;
    z-index: 2;
}
.rp-spec-hero__title em {
    font-style: italic;
    color: #5BC2B1;
    font-weight: 400;
}
.rp-spec-hero__img {
    position: absolute;
    right: -29px;
    bottom: -93px;
    width: 816px;
    height: 543px;
    pointer-events: none;
    z-index: 1;
}
.rp-spec-hero__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right bottom;
    display: block;
}

/* Grid */
.rp-spec-grid-section {
    margin: 48px auto 0;
    padding: 0 64px;
}
.rp-spec-grid {
    display: grid;
    grid-template-columns: repeat(3, 424px);
    justify-content: center;
    gap: 20px;
}

/* Card */
.rp-spec-card {
    position: relative;
    height: 197px;
    width: 424px;
    border-radius: 20px;
    border: 1px solid #DEEEEB;
    background: linear-gradient(133deg, #fff 0%, rgba(255, 255, 255, 0.62) 100%);
    color: #1D283A;
    text-decoration: none;
    display: block;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.rp-spec-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(29, 40, 58, 0.08);
}
.rp-spec-card__title {
    position: absolute;
    left: 40px;
    font-family: 'Proxima Nova', sans-serif;
    font-weight: 400;
    font-size: 26px;
    line-height: 1.19;
    color: #1D283A;
    max-width: 220px;
    z-index: 2;
}
.rp-spec-card__img {
    position: absolute;
    display: block;
    pointer-events: none;
    z-index: 1;
}
.rp-spec-card__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Desktop-exact title/image positions (Figma node 328:21) */
@media (min-width: 992px) {
    .rp-spec-card--weight-loss .rp-spec-card__title,
    .rp-spec-card--longevity   .rp-spec-card__title,
    .rp-spec-card--peptides    .rp-spec-card__title,
    .rp-spec-card--dermatology .rp-spec-card__title,
    .rp-spec-card--sexual      .rp-spec-card__title,
    .rp-spec-card--veterinary  .rp-spec-card__title { top: 83px; }

    .rp-spec-card--hrt         .rp-spec-card__title { top: 52px; }

    .rp-spec-card--mens        .rp-spec-card__title,
    .rp-spec-card--womens      .rp-spec-card__title,
    .rp-spec-card--digestive   .rp-spec-card__title,
    .rp-spec-card--commercial  .rp-spec-card__title,
    .rp-spec-card--pain        .rp-spec-card__title { top: 67px; }

    .rp-spec-card--weight-loss .rp-spec-card__img { left: 254px;   top: 0;     width: 161px;    height: 197px; }
    .rp-spec-card--hrt         .rp-spec-card__img { left: 224.3px; top: 13px;  width: 158.4px;  height: 184.18px; }
    .rp-spec-card--longevity   .rp-spec-card__img { left: 230px;   top: -16px; width: 194.5px;  height: 259.51px; }
    .rp-spec-card--peptides    .rp-spec-card__img { left: 128px;   top: 0;     width: 295.5px;  height: 196.95px; }
    .rp-spec-card--mens        .rp-spec-card__img { left: 186px;   top: 9px;   width: 215px;    height: 275px; }
    .rp-spec-card--womens      .rp-spec-card__img { left: 226px;   top: 14px;  width: 177.5px;  height: 177.5px; }
    .rp-spec-card--digestive   .rp-spec-card__img { left: 247.94px;top: 8px;   width: 167.13px; height: 198px; }
    .rp-spec-card--dermatology .rp-spec-card__img { left: 160px;   top: 0;     width: 278.23px; height: 199.28px; }
    .rp-spec-card--sexual      .rp-spec-card__img { left: 218px;   top: 20px;  width: 213px;    height: 173.04px; }
    .rp-spec-card--commercial  .rp-spec-card__img { left: 256px;   top: 16px;  width: 154px;    height: 180.77px; }
    .rp-spec-card--pain        .rp-spec-card__img { left: 260px;   top: 0;     width: 141.91px; height: 201px; }
    .rp-spec-card--veterinary  .rp-spec-card__img { left: 230px;   top: 7px;   width: 194px;    height: 190.29px; }
}

/* CTA modifier — reuses .richmond-cta-section from richmond-pharmacy.css */
.rp-spec-cta {
    margin-top: 100px;
}

/* ===== Responsive ===== */
@media (max-width: 1439px) {
    /* hero still works since image is clipped by overflow:hidden; just ensure inner scales */
    .rp-spec-hero__inner { max-width: 1360px; margin: 0 auto; }
    /* 3-cols grid (1312px) doesn't fit at <1440; drop to 2-col to avoid h-scroll */
    .rp-spec-grid { grid-template-columns: repeat(2, 424px); }
}

@media (max-width: 1280px) {
    .rp-spec-hero__img {
        width: 650px;
        height: 433px;
        bottom: -75px;
    }
}

@media (max-width: 1200px) {
    .rp-spec-hero { padding: 0 20px; }
    .rp-spec-hero__title { font-size: 64px; max-width: 420px; }
}

@media (max-width: 1100px) {
    .rp-spec-hero__img {
        width: 520px;
        height: 346px;
        bottom: -40px;
    }
}

@media (max-width: 991px) {
    /* Switch cards to flex layout, grid 1 column */
    .rp-spec-hero__inner { height: 260px; border-radius: 28px; }
    .rp-spec-hero__title {
        left: 40px;
        top: 40px;
        font-size: 48px;
        line-height: 1.1;
        max-width: 320px;
    }
    .rp-spec-hero__img {
        right: -120px;
        top: auto;
        bottom: -60px;
        width: 600px;
        height: 400px;
    }

    .rp-spec-grid-section { padding: 0 24px; }
    .rp-spec-grid {
        grid-template-columns: minmax(0, 560px);
        justify-content: center;
        gap: 16px;
    }
    .rp-spec-card {
        width: 100%;
        height: auto;
        min-height: 140px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 0 20px 28px;
        overflow: hidden;
    }
    .rp-spec-card__title {
        position: static;
        left: auto;
        top: auto;
        max-width: calc(100% - 160px);
        font-size: 22px;
        line-height: 1.2;
    }
    .rp-spec-card__img {
        position: relative;
        left: auto;
        top: auto;
        width: 140px;
        height: 140px;
        flex-shrink: 0;
    }
    .rp-spec-card__img img {
        object-fit: contain;
        object-position: center right;
    }

    .rp-spec-cta { margin-top: 60px; }
}

@media (max-width: 750px) {
    .rp-spec-hero { padding: 0 10px; }
}

/* ===== Mobile (≤600): from Figma 354:2 "Richmond Pharmacy s m" ===== */
@media (max-width: 600px) {
    .rp-spec-page { padding: 20px 0 40px; background: #F3F3F3; }

    /* Hero (354:631) */
    .rp-spec-hero { padding: 0 16px; }
    .rp-spec-hero__inner {
        height: 212px;
        max-width: 328px;
        margin: 0 auto;
        border-radius: 38px;
        background: rgba(255, 255, 255, 0.1);
        box-shadow:
            inset 0 0 0 1px #ffffff,
            inset 0 0 4px rgba(0, 0, 0, 0.05);
    }
    .rp-spec-hero__title {
        left: 21px;
        top: 27px;
        right: 21px;
        font-size: 48px;
        line-height: 1.08;
        max-width: 286px;
        text-align: center;
    }
    .rp-spec-hero__title em { color: #5BC2B1; font-weight: 400; }
    .rp-spec-hero__img {
        left: 0;
        right: auto;
        top: 5.33px;
        bottom: auto;
        width: 345px;
        height: 229.6px;
    }
    .rp-spec-hero__img img { object-fit: fill; object-position: center; }

    /* Grid (354:634) — 12 cards single column, 328 wide on 360 viewport */
    .rp-spec-grid-section {
        margin: 20px auto 0;
        padding: 0 16px;
    }
    .rp-spec-grid {
        grid-template-columns: minmax(0, 328px);
        gap: 20px;
    }

    /* Card (354:636 etc) — reset 991 flex, use absolute positioning per-card */
    .rp-spec-card {
        width: 100%;
        max-width: 328px;
        height: 197px;
        min-height: 197px;
        border-radius: 20px;
        display: block;
        padding: 0;
        overflow: hidden;
    }
    .rp-spec-card__title {
        position: absolute;
        left: 40px;
        right: auto;
        font-size: 26px;
        line-height: 1.192; /* 31/26 */
        font-weight: 400;
        max-width: 160px;
        z-index: 2;
    }
    .rp-spec-card__img {
        position: absolute;
        display: block;
    }
    .rp-spec-card__img img { object-fit: contain; object-position: center; }

    /* Per-card title + image positions (Figma 354:636..683) */
    .rp-spec-card--weight-loss .rp-spec-card__title { top: 83px; }
    .rp-spec-card--weight-loss .rp-spec-card__img   { left: 162px; top: 0;    width: 161px;   height: 197px; }

    .rp-spec-card--hrt         .rp-spec-card__title { top: 52px; }
    .rp-spec-card--hrt         .rp-spec-card__img   { left: 184.3px; top: 13px; width: 158.4px; height: 184.2px; }

    .rp-spec-card--longevity   .rp-spec-card__title { top: 83px; }
    .rp-spec-card--longevity   .rp-spec-card__img   { left: 154px; top: -16px; width: 194.5px; height: 259.5px; }

    .rp-spec-card--peptides    .rp-spec-card__title { top: 83px; }
    .rp-spec-card--peptides    .rp-spec-card__img   { left: 41px;  top: 1px;  width: 286px;   height: 196px; }

    .rp-spec-card--mens        .rp-spec-card__title { top: 67px; max-width: 108px; }
    .rp-spec-card--mens        .rp-spec-card__img   { left: 117px; top: 9px;  width: 215px;   height: 275px; }

    .rp-spec-card--womens      .rp-spec-card__title { top: 67px; max-width: 126px; }
    .rp-spec-card--womens      .rp-spec-card__img   { left: 156px; top: 14px; width: 177.5px; height: 177.5px; }

    .rp-spec-card--digestive   .rp-spec-card__title { top: 67px; }
    .rp-spec-card--digestive   .rp-spec-card__img   { left: 157.9px; top: 8px; width: 167.1px; height: 198px; }

    .rp-spec-card--dermatology .rp-spec-card__title { top: 83px; }
    .rp-spec-card--dermatology .rp-spec-card__img   { left: 88px;  top: 0;    width: 278.2px; height: 199.3px; }

    .rp-spec-card--sexual      .rp-spec-card__title { top: 83px; }
    .rp-spec-card--sexual      .rp-spec-card__img   { left: 177px; top: 20px; width: 213px;   height: 173px; }

    .rp-spec-card--commercial  .rp-spec-card__title { top: 67px; }
    .rp-spec-card--commercial  .rp-spec-card__img   { left: 169px; top: 16px; width: 154px;   height: 180.8px; }

    .rp-spec-card--pain        .rp-spec-card__title { top: 67px; }
    .rp-spec-card--pain        .rp-spec-card__img   { left: 179px; top: 0;    width: 141.9px; height: 201px; }

    .rp-spec-card--veterinary  .rp-spec-card__title { top: 83px; }
    .rp-spec-card--veterinary  .rp-spec-card__img   { left: 168px; top: 7px;  width: 194px;   height: 190.3px; }

    /* CTA (354:687) — local mobile override of shared .richmond-cta-section.
       Figma bg is 516×531 extending past viewport; emulate edge-to-edge with
       mobile-specific bg image (sp-cta-mobile.webp from Figma imageRef 4e890d7d). */
    .rp-spec-cta.richmond-cta-section {
        margin: 20px 0 0;
        max-width: none;
        width: 100%;
        padding: 52px 16px;
        min-height: 531px;
        border-radius: 0;
        background-image: url('/assets/img/richmond/specialties/sp-cta-mobile.webp') !important;
        background-size: cover;
        background-position: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        text-align: center;
    }
    .rp-spec-cta.richmond-cta-section::before {
        border-radius: 0;
        background: rgba(0, 0, 0, 0.2);
    }
    .rp-spec-cta .richmond-cta__heading {
        max-width: 328px;
        font-size: 38px;
        line-height: 1.105;
        color: #EEF5F3;
    }
    .rp-spec-cta .richmond-cta__desc {
        max-width: 328px;
        margin: 0;
        font-size: 18px;
        line-height: 1.111;
        color: #EEF5F3;
    }
    .rp-spec-cta .richmond-cta__btn {
        width: 100%;
        max-width: 328px;
        height: 49px;
        padding: 15px 25px;
        border-radius: 30px;
        background: #1D283A;
        color: #EEF5F3;
        font-size: 16px;
        line-height: 1.218;
        font-weight: 600;
    }
}

@media (max-width: 360px) {
    /* Cards are max-width 328; with 16+16 side padding they fit on exactly 360.
       On narrower devices (e.g. 320), cards shrink — some titles may wrap;
       per-card image positions remain absolute relative to card box. */
    .rp-spec-hero__inner { max-width: 100%; }
    .rp-spec-card { max-width: 100%; }
    .rp-spec-cta.richmond-cta-section { margin: 20px 0 0; }
}
