/* ==========================================================================
   LIVZO — Society Services section
   (config `services`, rendered on society.php and complete-profile.php)

   Class prefix: lz-svc-*  (module 4's comparison styles are lz-compare__* /
   lz-cmp-*, this page's are lz-sp-*, the directory's lz-dir-* — none collide)

   Layout
     ≥1200px : 5 company cards per row
     ≤1199px : 4   ≤991px : 3   ≤767px : 2
   Every card draws its logo in the same fixed 56px box, so a wide wordmark and a
   square icon read the same size (base.css caps every img at max-width:100%, so
   the box — not the bitmap — is what decides).

   Motion
     reveal-on-scroll → [data-lz-inview] + .is-in (the global observer in
     assets/js/societies.js — no second observer here)
   ========================================================================== */

/* ===== 1. Section shell ================================================= */

.lz-svc {
    position: relative;
    padding-block: clamp(46px, 6.4vw, 82px);
}

.lz-svc[hidden] {
    display: none;
}

.lz-svc__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(22px, 3vw, 32px);
}

.has-js .lz-svc [data-lz-inview] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--lz-t-slow) var(--lz-ease-out), transform var(--lz-t-slow) var(--lz-ease-out);
    transition-delay: var(--lz-delay, 0ms);
}

.has-js .lz-svc [data-lz-inview].is-in {
    opacity: 1;
    transform: none;
}

/* ===== 2. Head band ===================================================== */

.lz-svc__head {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(16px, 3vw, 30px);
    padding: clamp(22px, 3.4vw, 34px) clamp(20px, 3.4vw, 38px);
    border: 1px solid var(--lz-line);
    border-radius: var(--lz-r-xl);
    background:
        radial-gradient(120% 180% at 100% 0%, var(--lz-accent-soft-2), transparent 62%),
        linear-gradient(180deg, var(--lz-surface), var(--lz-bg-2));
    box-shadow: var(--lz-sh-2);
    overflow: hidden;
}

/* Decorative accent hairline across the top edge — decoration only, so no text
   ever sits on a gradient and the panel's own colour stays a flat, computable one. */
.lz-svc__head::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--lz-accent), var(--lz-accent-600), var(--lz-amber));
}

.lz-svc__eyebrow {
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lz-accent-700);
}

.lz-svc__title {
    margin: 0;
    font-size: clamp(1.34rem, 3.2vw, 2rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--lz-navy);
}

.lz-svc__lead {
    margin: 10px 0 0;
    max-width: 62ch;
    font-size: 0.94rem;
    line-height: 1.62;
    color: var(--lz-body);
}

.lz-svc__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
}

.lz-svc__fact {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: var(--lz-r-pill);
    background: var(--lz-surface);
    border: 1px solid var(--lz-line);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--lz-accent-700);
}

.lz-svc__head-ico {
    display: grid;
    place-items: center;
    width: clamp(52px, 7vw, 74px);
    height: clamp(52px, 7vw, 74px);
    border-radius: var(--lz-r-lg);
    background: var(--lz-surface);
    border: 1px solid var(--lz-line);
    box-shadow: var(--lz-sh-1);
    color: var(--lz-accent-600);
    flex-shrink: 0;
}

.lz-svc__head-ico .lz-icon {
    width: clamp(24px, 3.4vw, 34px);
    height: clamp(24px, 3.4vw, 34px);
}

/* ===== 3. Category chips ================================================ */

.lz-svc__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.lz-svc__chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 8px 15px;
    border-radius: var(--lz-r-pill);
    border: 1px solid var(--lz-line);
    background: var(--lz-surface);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--lz-navy-2);
    text-decoration: none;
    transition: border-color var(--lz-t) var(--lz-ease-out), color var(--lz-t) var(--lz-ease-out),
        transform var(--lz-t) var(--lz-ease-out), box-shadow var(--lz-t) var(--lz-ease-out);
}

.lz-svc__chip-ico {
    display: inline-flex;
    color: var(--lz-accent-700);
}

.lz-svc__chip-ico .lz-icon {
    width: 16px;
    height: 16px;
}

.lz-svc__chip:hover {
    border-color: var(--lz-accent-ring);
    color: var(--lz-accent-700);
    transform: translateY(-2px);
    box-shadow: var(--lz-sh-2);
}

/* ===== 4. Note + live status =========================================== */

.lz-svc__note {
    margin: -6px 0 0;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--lz-body);
}

/* `.lz-svc__rater`/`__note` own a `display`, which beats the UA [hidden] rule — a hidden
   control would otherwise stay on screen (the §28 lesson). */
.lz-svc__rater[hidden],
.lz-svc__note[hidden] {
    display: none;
}

.lz-svc__status {
    margin: 0;
    min-height: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--lz-body);
}

.lz-svc__status:empty {
    display: none;
}

.lz-svc__status.is-error {
    color: var(--lz-band-danger-text);
}

.lz-svc__status.is-saved {
    color: var(--lz-band-success-text);
}

/* ===== 5. Category block =============================================== */

.lz-svc__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(26px, 4vw, 40px);
}

.lz-svc__cat {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    scroll-margin-top: calc(var(--lz-header-h) + 20px);
}

.lz-svc__cat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--lz-navy);
}

.lz-svc__cat-ico {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--lz-r-sm);
    background: var(--lz-accent-soft);
    color: var(--lz-accent-700);
    flex-shrink: 0;
}

.lz-svc__cat-ico .lz-icon {
    width: 17px;
    height: 17px;
}

.lz-svc__cat-count {
    display: inline-flex;
    align-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    border-radius: var(--lz-r-pill);
    background: var(--lz-bg-2);
    border: 1px solid var(--lz-line);
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--lz-body);
}

.lz-svc__grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ===== 6. Company card ================================================= */

.lz-svc__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    align-content: start;
    gap: 9px;
    padding: 16px 12px 14px;
    border: 1px solid var(--lz-line);
    border-radius: var(--lz-r-lg);
    background: var(--lz-surface);
    box-shadow: var(--lz-sh-1);
    text-align: center;
    transition: transform var(--lz-t) var(--lz-ease-out), box-shadow var(--lz-t) var(--lz-ease-out),
        border-color var(--lz-t) var(--lz-ease-out);
}

.lz-svc__card:hover {
    transform: translateY(-4px);
    border-color: var(--lz-accent-ring);
    box-shadow: var(--lz-sh-3);
}

.lz-svc__card.is-saving {
    opacity: 0.72;
}

.lz-svc__logo {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: var(--lz-r-md);
    background: var(--lz-surface);
    border: 1px solid var(--lz-line);
    overflow: hidden;
    flex-shrink: 0;
}

.lz-svc__logo-img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    padding: 9px;
    box-sizing: border-box;
}

.lz-svc__logo-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--lz-accent-700);
    background: var(--lz-accent-soft);
}

.lz-svc__name {
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.28;
    color: var(--lz-navy);
    min-height: 2.56em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lz-svc__score {
    display: grid;
    justify-items: center;
    gap: 4px;
    min-height: 2.9em;
    align-content: start;
}

.lz-svc__stars .lz-stars__layer {
    gap: 2px;
}

.lz-svc__stars .lz-stars__layer .lz-icon {
    width: 14px;
    height: 14px;
}

.lz-svc__meta {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--lz-body);
}

.lz-svc__avg {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--lz-navy);
}

.lz-svc__empty {
    font-size: 0.72rem;
    color: var(--lz-body);
}

/* Only one of {meta, empty} is ever shown — the scored pills and the honest
   "no ratings yet" never sit side by side. */
.lz-svc__score[data-lz-svc-state="empty"] .lz-svc__meta {
    display: none;
}

.lz-svc__score:not([data-lz-svc-state="empty"]) .lz-svc__empty {
    display: none;
}

/* ===== 7. Rate control ================================================= */

.lz-svc__rater {
    display: grid;
    justify-items: center;
    gap: 5px;
    margin-top: 2px;
}

.lz-svc__rater-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--lz-body);
}

.lz-svc__rater-stars {
    display: inline-flex;
    gap: 2px;
}

.lz-svc__star {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    color: var(--lz-muted);
    transition: color var(--lz-t-fast) var(--lz-ease-out), transform var(--lz-t-fast) var(--lz-ease-out);
}

.lz-svc__star .lz-icon {
    width: 16px;
    height: 16px;
}

.lz-svc__star[aria-checked="true"] {
    color: var(--lz-amber);
}

.lz-svc__star:not(:disabled):hover {
    color: var(--lz-amber);
    transform: translateY(-1px);
}

.lz-svc__star:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* ===== 8. Disclaimer =================================================== */

.lz-svc__disclaimer {
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.5;
    color: var(--lz-body);
}

/* ===== 9. Focus ======================================================== */

.lz-svc a:focus-visible,
.lz-svc button:focus-visible,
.lz-svc [tabindex]:focus-visible {
    outline: 2px solid var(--lz-accent);
    outline-offset: 2px;
    border-radius: var(--lz-r-xs);
}

/* ===== 10. Responsive ================================================== */

@media (max-width: 1199px) {
    .lz-svc__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .lz-svc__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .lz-svc__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .lz-svc__head {
        grid-template-columns: minmax(0, 1fr);
        justify-items: start;
    }

    .lz-svc__head-ico {
        order: -1;
    }

    /* One swipe row instead of three wrapped lines — the standing "pills must
       not wrap on mobile" rule. The links stay focusable, so the scrollable
       region needs no extra tab stop (gotcha 10 does not apply here). */
    .lz-svc__chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .lz-svc__chip {
        padding: 7px 13px;
        font-size: 0.76rem;
    }
}

@media (max-width: 400px) {
    .lz-svc__card {
        padding: 13px 9px 12px;
    }

    .lz-svc__logo {
        width: 50px;
        height: 50px;
    }
}

/* ===== 11. Reduced motion ============================================= */

@media (prefers-reduced-motion: reduce) {
    .has-js .lz-svc [data-lz-inview] {
        opacity: 1;
        transform: none;
    }

    .lz-svc__card,
    .lz-svc__chip,
    .lz-svc__star {
        transition: none;
    }

    .lz-svc__card:hover,
    .lz-svc__chip:hover,
    .lz-svc__star:not(:disabled):hover {
        transform: none;
    }
}
