/*
 * Jewellery Hospital — before / after showcase
 * Builds on custom.css + theme-extra.css tokens (accent, secondary, cream, fonts).
 */

.jewellery-hospital {
    --hospital-ink: var(--color-secondary);
    --hospital-muted: #6b6b6b;
    --hospital-line: rgba(1, 53, 75, .1);
    --hospital-card: rgba(255, 255, 255, .96);
    --hospital-radius: 20px 5px 20px 5px; /* same signature shape as .btn */
    --hospital-shadow: 0 4px 20px rgba(0, 0, 0, .07);
    --hospital-shadow-hover: 0 14px 36px rgba(1, 53, 75, .14);
}

/* ── Banner ─────────────────────────────────────────────────────────────── */
.hospital-banner .banner-info h1 { margin-bottom: 14px; }
.hospital-banner__text {
    max-width: 560px;
    margin: 0 auto;
    color: rgba(255, 255, 255, .92);
    font-family: var(--ff-title-sub);
    font-style: italic;
    font-size: var(--f-size-S);
    line-height: 1.5;
}

/* ── Intro + process ────────────────────────────────────────────────────── */
.hospital-intro__copy h2 { margin-bottom: 20px; }
.hospital-intro__copy p {
    color: var(--hospital-muted);
    line-height: 1.85;
    margin: 0;
}

.hospital-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}
.hospital-step {
    position: relative;
    padding: 26px 26px 24px;
    background: var(--hospital-card);
    border: 1px solid var(--hospital-line);
    border-radius: var(--hospital-radius);
    box-shadow: var(--hospital-shadow);
    transition: transform .4s ease, box-shadow .4s ease;
}
.hospital-step:hover {
    transform: translateY(-4px);
    box-shadow: var(--hospital-shadow-hover);
}
.hospital-step__num {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    font-family: var(--ff-title-sub);
    font-style: italic;
    font-size: 30px;
    line-height: 1;
    color: var(--color-accent);
}
.hospital-step__num::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(160, 11, 17, .35), transparent);
}
.hospital-step__title {
    margin: 0 0 6px;
    font-size: var(--f-size-S);
    font-weight: var(--fw-semi-bold);
    color: var(--hospital-ink);
}
.hospital-step__text {
    margin: 0;
    font-size: var(--f-size-ES);
    line-height: 1.65;
    color: var(--hospital-muted);
}

.hospital-steps__label {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: var(--fw-bold);
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--hospital-muted);
}

/* ── New jewellery making timeline ──────────────────────────────────────── */
.hospital-making__text {
    max-width: 620px;
    margin: 0 auto;
    color: var(--hospital-muted);
    line-height: 1.8;
}
.hospital-making .sub-title { margin-bottom: 16px !important; }

.making-timeline {
    --dot: 58px;
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(var(--making-steps, 5), minmax(0, 1fr));
    gap: 24px;
}
/* Gold thread joining the steps, from the first dot centre to the last */
.making-timeline::before {
    content: "";
    position: absolute;
    top: calc(var(--dot) / 2);
    left: calc(100% / var(--making-steps, 5) / 2);
    right: calc(100% / var(--making-steps, 5) / 2);
    height: 1px;
    background: repeating-linear-gradient(90deg, rgba(160, 11, 17, .45) 0 6px, transparent 6px 12px);
}
.making-step {
    position: relative;
    text-align: center;
}
.making-step__dot {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--dot);
    height: var(--dot);
    margin-bottom: 18px;
    border-radius: 50%;
    font-family: var(--ff-title-sub);
    font-style: italic;
    font-size: 24px;
    color: var(--color-accent);
    background: #fff;
    border: 1px solid rgba(160, 11, 17, .35);
    box-shadow: 0 0 0 6px #fff, 0 8px 22px rgba(160, 11, 17, .12);
    transition: background-color .35s ease, color .35s ease, transform .35s ease;
}
.making-step:hover .making-step__dot {
    color: #fff;
    background: var(--color-accent);
    transform: translateY(-3px);
}
.making-step__title {
    margin: 0 0 6px;
    font-size: var(--f-size-S);
    font-weight: var(--fw-semi-bold);
    color: var(--hospital-ink);
}
.making-step__text {
    max-width: 220px;
    margin: 0 auto;
    font-size: var(--f-size-ES);
    line-height: 1.65;
    color: var(--hospital-muted);
}

/* ── Type switch (All / Restoration / New Creations) ────────────────────── */
.hospital-types {
    display: flex;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 28px;
    padding: 5px;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--hospital-line);
    border-radius: 40px;
    box-shadow: var(--hospital-shadow);
}
.hospital-types__btn {
    padding: 10px 22px;
    border: 0;
    border-radius: 40px;
    background: transparent;
    font-size: var(--f-size-ES);
    font-weight: var(--fw-semi-bold);
    color: var(--hospital-ink);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .3s ease, color .3s ease;
}
.hospital-types__btn:hover { color: var(--color-accent); }
.hospital-types__btn.is-active { color: #fff; background: var(--color-accent); }
.hospital-types__btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── Category panel ─────────────────────────────────────────────────────── */
.hospital-panel { margin: 0 auto var(--gap-50); }
.hospital-panel__list {
    position: relative; /* offsetParent for the mobile scroll-to-active logic */
    list-style: none;
    margin: 0;
    padding: 4px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}
.hospital-panel__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 128px;
    padding: 16px 10px 14px;
    text-align: center;
    text-decoration: none;
    color: var(--hospital-ink);
    background: var(--hospital-card);
    border: 1px solid var(--hospital-line);
    border-radius: var(--hospital-radius);
    transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease, color .35s ease;
}
.hospital-panel__item:hover {
    color: var(--color-accent);
    transform: translateY(-3px);
    box-shadow: var(--hospital-shadow-hover);
}
.hospital-panel__item:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}
.hospital-panel__media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    background: #f7f1e9;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--hospital-line);
    transition: box-shadow .35s ease;
}
.hospital-panel__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s ease;
}
.hospital-panel__item:hover .hospital-panel__media img { transform: scale(1.08); }
.hospital-panel__media--all { color: var(--color-accent); }
.hospital-panel__name {
    font-size: var(--f-size-ES);
    font-weight: var(--fw-semi-bold);
    line-height: 1.3;
}
.hospital-panel__count {
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: var(--fw-bold);
    line-height: 1.5;
    color: var(--hospital-muted);
    background: rgba(1, 53, 75, .06);
    transition: background-color .35s ease, color .35s ease;
}
.hospital-panel__item.is-active {
    color: var(--color-accent);
    border-color: rgba(160, 11, 17, .35);
    box-shadow: var(--hospital-shadow-hover);
}
.hospital-panel__item.is-active .hospital-panel__media {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--color-accent);
}
.hospital-panel__item.is-active .hospital-panel__count {
    color: #fff;
    background: var(--color-accent);
}
/* No work of the selected type in this category */
.hospital-panel__item.is-empty:not(.is-active) { opacity: .45; }

/* ── Case grid ──────────────────────────────────────────────────────────── */
.hospital-grid__col.is-hidden { display: none; }
.hospital-grid__col.is-entering { animation: hospital-enter .55s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes hospital-enter {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

.hospital-case {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--hospital-shadow);
    scroll-margin-top: 120px;
    transition: box-shadow .4s ease;
}
.hospital-case:hover { box-shadow: var(--hospital-shadow-hover); }
.hospital-case:target { box-shadow: 0 0 0 2px var(--color-accent), var(--hospital-shadow-hover); }

.hospital-case__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 26px 22px;
}
.hospital-case__tags {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}
.hospital-case__tags li {
    position: relative;
    font-size: 11px;
    font-weight: var(--fw-bold);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--color-accent);
}
.hospital-case__tags li + li::before {
    content: "";
    position: absolute;
    left: -9px;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    border-radius: 50%;
    background: currentColor;
    opacity: .5;
}
.hospital-case__title {
    margin: 0 0 8px;
    font-family: var(--ff-title-sub);
    font-size: var(--f-size-M);
    font-weight: var(--fw-medium);
    line-height: 1.25;
    color: var(--hospital-ink);
}
.hospital-case__treatment {
    margin: 0 0 8px;
    font-weight: var(--fw-semi-bold);
    font-size: 15px;
    color: var(--color-primary);
}
.hospital-case__story {
    margin: 0;
    font-size: var(--f-size-ES);
    line-height: 1.75;
    color: var(--hospital-muted);
}
.hospital-case__content { margin-bottom: 18px; }
.hospital-case__footer {
    margin-top: auto;
    padding-top: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    border-top: 1px dashed var(--hospital-line);
}
.hospital-case__meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--f-size-ES);
    color: var(--hospital-muted);
}
.hospital-case__enquire {
    margin-left: auto;
    padding: 0 0 2px;
    border: 0;
    background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
    font-size: var(--f-size-ES);
    font-weight: var(--fw-semi-bold);
    color: var(--color-accent);
    cursor: pointer;
    transition: background-size .35s ease;
}
.hospital-case__enquire span { display: inline-block; transition: transform .35s ease; }
.hospital-case__enquire:hover,
.hospital-case__enquire:focus-visible { background-size: 100% 1px; outline: none; }
.hospital-case__enquire:hover span { transform: translateX(4px); }

/* ── Before / after comparison ──────────────────────────────────────────── */
.ba-compare {
    position: relative;
    margin: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #efe8de;
    cursor: ew-resize;
    touch-action: pan-y;          /* vertical scroll still works on touch */
    user-select: none;
    -webkit-user-select: none;
}
.ba-compare__img,
.ba-compare__before {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.ba-compare__img {
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}
.ba-compare__before {
    clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
}

.ba-compare__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--ba-pos);
    width: 44px;
    margin-left: -22px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    outline: none;
}
.ba-compare__handle::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, .35);
}
.ba-compare__knob {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    color: var(--color-accent);
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    transition: transform .25s ease, box-shadow .25s ease;
}
.ba-compare:hover .ba-compare__knob,
.ba-compare.is-dragging .ba-compare__knob { transform: scale(1.08); }
.ba-compare__handle:focus-visible .ba-compare__knob {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--color-accent);
}

.ba-compare__label {
    position: absolute;
    bottom: 16px;
    z-index: 1;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: var(--fw-bold);
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0, 0, 0, .45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    pointer-events: none;
    transition: opacity .3s ease;
}
.ba-compare__label--before { left: 16px; }
.ba-compare__label--after  { right: 16px; background: rgba(160, 11, 17, .78); }
.ba-compare.hide-before .ba-compare__label--before,
.ba-compare.hide-after  .ba-compare__label--after { opacity: 0; }

.ba-compare__badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1;
    padding: 6px 12px;
    border-radius: 4px 12px 4px 12px;
    font-size: 11px;
    font-weight: var(--fw-bold);
    letter-spacing: .08em;
    color: var(--hospital-ink);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    pointer-events: none;
}
.hospital-case--making .ba-compare__badge { color: #fff; background: var(--color-secondary); }

.ba-compare__zoom {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--hospital-ink);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    opacity: 0;
    transform: scale(.9);
    transition: opacity .3s ease, transform .3s ease, color .3s ease;
    cursor: zoom-in;
}
.ba-compare:hover .ba-compare__zoom,
.ba-compare__zoom:focus-visible { opacity: 1; transform: none; }
.ba-compare__zoom:hover { color: var(--color-accent); }
@media (hover: none) {
    .ba-compare__zoom { opacity: 1; transform: none; }
}

/* ── Empty states ───────────────────────────────────────────────────────── */
.hospital-empty {
    margin: 10px 0 0;
    font-family: var(--ff-title-sub);
    font-style: italic;
    font-size: var(--f-size-S);
    color: var(--hospital-muted);
}
.hospital-empty--page {
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 30px;
    background: var(--hospital-card);
    border: 1px dashed rgba(160, 11, 17, .3);
    border-radius: var(--hospital-radius);
}
.hospital-empty--page p { margin: 0; }

/* ── CTA ────────────────────────────────────────────────────────────────── */
.hospital-cta__inner {
    position: relative;
    overflow: hidden;
    padding: clamp(44px, 6vw, 72px) clamp(24px, 5vw, 64px);
    border-radius: 30px 8px 30px 8px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .08), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(160, 11, 17, .45), transparent 55%),
        var(--color-secondary);
    box-shadow: 0 20px 50px rgba(1, 53, 75, .25);
}
.hospital-cta__inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--motif-tile);
    background-size: var(--motif-size);
    opacity: .06;
    filter: invert(1);
    pointer-events: none;
}
.hospital-cta__inner > * { position: relative; }
.hospital-cta__inner h2 { color: #fff; margin-bottom: 14px; }
.hospital-cta__inner h2 strong { color: #f3d7a6; }
.hospital-cta__inner p {
    max-width: 520px;
    margin: 0 auto 30px;
    color: rgba(255, 255, 255, .82);
}
.hospital-cta__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px 30px;
}
.hospital-cta__phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: var(--fw-semi-bold);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .35);
    padding-bottom: 2px;
    transition: border-color .3s ease;
}
/* custom.css colours every a:link/:visited/:hover with the accent — override on navy */
.hospital-cta a.hospital-cta__phone,
.hospital-cta a.hospital-cta__phone:hover,
.hospital-cta a.hospital-cta__phone:focus { color: #fff; }
.hospital-cta__phone:hover { border-color: #fff; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .hospital-intro .row { row-gap: 36px; }

    /* Timeline turns vertical: dots on a left-hand thread */
    .making-timeline {
        --dot: 48px;
        grid-template-columns: 1fr;
        gap: 22px;
        max-width: 560px;
        margin: 0 auto;
    }
    .making-timeline::before {
        top: calc(var(--dot) / 2);
        bottom: calc(var(--dot) / 2);
        left: calc(var(--dot) / 2);
        right: auto;
        width: 1px;
        height: auto;
        background: repeating-linear-gradient(180deg, rgba(160, 11, 17, .45) 0 6px, transparent 6px 12px);
    }
    .making-step {
        display: flex;
        align-items: flex-start;
        gap: 18px;
        text-align: left;
    }
    .making-step__dot { flex: 0 0 auto; margin: 0; font-size: 20px; }
    .making-step__body { padding-top: 10px; }
    .making-step__text { max-width: none; margin: 0; }
}

@media (max-width: 767px) {
    .hospital-steps { gap: 14px; }
    .hospital-step { padding: 20px 18px; }
    .hospital-step__num { font-size: 24px; margin-bottom: 10px; }

    /* Category panel becomes a swipeable strip */
    .hospital-panel { margin-left: -12px; margin-right: -12px; }
    .hospital-panel__list {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 6px 12px 10px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
        mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
    }
    .hospital-panel__list::-webkit-scrollbar { display: none; }
    .hospital-panel__list > li { flex: 0 0 auto; scroll-snap-align: start; }
    .hospital-panel__item { width: 108px; padding: 12px 8px; }
    .hospital-panel__media { width: 60px; height: 60px; }

    .hospital-types { width: 100%; }
    .hospital-types__btn { flex: 1; padding: 10px 8px; }

    .hospital-case__body { padding: 20px 18px 18px; }
    .ba-compare__knob { width: 40px; height: 40px; }
    .ba-compare__label { bottom: 12px; padding: 4px 10px; font-size: 10px; }
    .ba-compare__label--before { left: 12px; }
    .ba-compare__label--after  { right: 12px; }
}

@media (max-width: 479px) {
    .hospital-steps { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .jewellery-hospital *,
    .jewellery-hospital *::before,
    .jewellery-hospital *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Clear the fixed header when jumping to the showcase */
#hospital-showcase { scroll-margin-top: 80px; }
