/* ==========================================================================
   Adilet.kz — public lawyer profile  (/yurist/<city>/<name>/ and siblings)
   Direction A, «Фасеты». Owns templates/core/lawyer_detail.html and nothing
   else. Loaded from that template's {% block extra_css %}, i.e. AFTER
   style.css, so every selector here is prefixed `lprof-` and cannot be reached
   by the 14k shared rules — and cannot reach them either. The exceptions are
   deliberate and scoped under .lprof-page: the review form's `form-*-modern`
   wrappers (core/forms.py emits those widget classes), the `lawyer-qa-*`
   answer cards, `badge-new-specialist` and Bootstrap's `.btn`.

   Three notes that are not obvious from the rules:

   1. The sticky element is the PRICE CARD, not the rail. A sticky box is
      confined to its parent, so pinning the whole rail would make the bottom of
      a tall rail (20 answer cards) unreachable while the page scrolls. Pinning
      the first child instead means the blocks under it eventually slide over
      it, which is why .lprof-rail-block is opaque and sits a layer above:
      transparent backgrounds there would show the card through them.

   2. The rail is `display: contents` under 992px so its children become items
      of the single-column grid and can be re-ordered: price card first (it
      carries the call to action), then the reading column, then answers and
      articles. The aside is a presentational grouping; every block inside it
      keeps its own heading.

   3. .lprof-rev-bar-n is left EMPTY by the template for a rating nobody gave -
      the template language has no arithmetic to produce a zero - so the `0` is
      written here with :empty::after. The histogram is aria-hidden; the same
      numbers are in the summary and the review list.
   ========================================================================== */

.lprof-page {
    /* Local tokens. Deliberately not :root - this file must not tint any other
       page, and style.css already owns the global names. */
    --lprof-primary: #8b0000;
    --lprof-primary-hover: #730c0b;
    --lprof-primary-tint: rgba(139, 0, 0, 0.08);
    --lprof-text: #343235;
    --lprof-gray: #6b7280;
    --lprof-light: #9ca3af;
    --lprof-bg: #f9fafb;
    --lprof-white: #ffffff;
    --lprof-border: #e5e7eb;
    --lprof-star: #f59e0b;
    --lprof-positive: #047857;
    --lprof-r-sm: 6px;
    --lprof-r: 8px;
    --lprof-r-lg: 12px;
    --lprof-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .05);
    --lprof-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
    --lprof-rail-w: 340px;
    --lprof-gap: 24px;
    /* Every anchor target clears the sticky site bar. navbar.js measures the
       bar into --app-header-h; never hard-code its height. */
    --lprof-anchor-offset: calc(var(--app-header-h) + 16px);

    max-width: 1320px;
    margin: 0 auto;
    color: var(--lprof-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Proxima Nova', 'Helvetica Neue', Arial, sans-serif;
}

/* style.css pads .breadcrumb by 15px to line it up with the old grid; inside
   this column that reads as an indent. */
.lprof-page .lprof-breadcrumb {
    padding-left: 0;
    padding-right: 0;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* ==========================================================================
   1. Hero
   ========================================================================== */

.lprof-hero {
    display: flex;
    align-items: flex-start;
    gap: var(--lprof-gap);
    background: var(--lprof-white);
    border: 1px solid var(--lprof-border);
    border-radius: var(--lprof-r-lg);
    box-shadow: var(--lprof-shadow-sm);
    padding: 24px;
    margin-bottom: var(--lprof-gap);
}

.lprof-hero-photo {
    flex: 0 0 auto;
    width: 160px;
    height: 160px;
}

.lprof-hero-photo img,
.lprof-hero-initials {
    width: 160px;
    height: 160px;
    border-radius: var(--lprof-r-lg);
    object-fit: cover;
    display: block;
}

.lprof-hero-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: var(--lprof-primary);
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    opacity: 0.85;
}

.lprof-hero-body {
    flex: 1 1 auto;
    min-width: 0;
}

.lprof-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--lprof-text);
    overflow-wrap: anywhere;
    margin: 0 0 0.35rem;
}

.lprof-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.35rem 0.6rem;
    border-radius: var(--lprof-r-sm);
    white-space: nowrap;
}

.lprof-badge-top {
    color: var(--lprof-primary);
    background: var(--lprof-primary-tint);
    border: 1px solid rgba(139, 0, 0, 0.18);
}

.lprof-badge-vip {
    color: #7c4a03;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.lprof-badge-vip .bi-question-circle {
    cursor: help;
    font-size: 0.8rem;
    opacity: 0.75;
}

.lprof-kicker {
    font-size: 0.95rem;
    color: var(--lprof-gray);
    margin: 0 0 0.6rem;
}

.lprof-sep {
    padding: 0 0.45rem;
    color: var(--lprof-light);
}

.lprof-rating {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.lprof-stars {
    display: inline-flex;
    gap: 0.1rem;
    color: var(--lprof-star);
    font-size: 0.95rem;
    line-height: 1;
}

.lprof-stars .bi-star {
    color: var(--lprof-border);
}

.lprof-stars-lg {
    font-size: 1.15rem;
}

.lprof-rating-value {
    font-size: 1.05rem;
    font-weight: 700;
}

.lprof-rating-count {
    font-size: 0.9rem;
    color: var(--lprof-primary);
    text-decoration: none;
}

.lprof-rating-count:hover,
.lprof-rating-count:focus-visible {
    color: var(--lprof-primary-hover);
    text-decoration: underline;
}

.lprof-muted {
    color: var(--lprof-gray);
    font-size: 0.9rem;
    margin: 0;
}

.lprof-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.lprof-chip {
    display: inline-block;
    max-width: 100%;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--lprof-border);
    border-radius: 999px;
    background: var(--lprof-bg);
    color: var(--lprof-text);
    font-size: 0.82rem;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.lprof-chip:hover,
.lprof-chip:focus-visible {
    background: var(--lprof-primary-tint);
    border-color: rgba(139, 0, 0, 0.25);
    color: var(--lprof-primary);
}

.lprof-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.1rem;
}

.lprof-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--lprof-gray);
}

.lprof-meta-item i {
    font-size: 0.95rem;
    color: var(--lprof-light);
}

.lprof-meta-item.is-positive i {
    color: var(--lprof-positive);
}

/* ==========================================================================
   2. Body grid
   ========================================================================== */

.lprof-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--lprof-rail-w);
    gap: var(--lprof-gap);
    align-items: start;
}

.lprof-main {
    min-width: 0;
}

/* The rail stretches to the main column's height on purpose: that stretched box
   is what the sticky price card travels inside. */
.lprof-rail {
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: var(--lprof-gap);
}

/* ==========================================================================
   3. Section nav + sections
   ========================================================================== */

.lprof-secnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    background: var(--lprof-white);
    border: 1px solid var(--lprof-border);
    border-radius: var(--lprof-r-lg);
    box-shadow: var(--lprof-shadow-sm);
    padding: 6px;
    margin-bottom: var(--lprof-gap);
}

.lprof-secnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--lprof-r);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--lprof-gray);
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.lprof-secnav-link:hover,
.lprof-secnav-link:focus-visible {
    background: var(--lprof-bg);
    color: var(--lprof-primary);
}

.lprof-secnav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--lprof-primary-tint);
    color: var(--lprof-primary);
    font-size: 0.75rem;
    font-weight: 700;
}

.lprof-section {
    background: var(--lprof-white);
    border: 1px solid var(--lprof-border);
    border-radius: var(--lprof-r-lg);
    box-shadow: var(--lprof-shadow-sm);
    padding: 24px;
    margin-bottom: var(--lprof-gap);
    scroll-margin-top: var(--lprof-anchor-offset);
}

.lprof-section:last-child {
    margin-bottom: 0;
}

.lprof-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 1rem;
}

.lprof-sub-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.6rem;
}

.lprof-prose {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--lprof-text);
    overflow-wrap: anywhere;
}

.lprof-prose p {
    margin: 0 0 0.75rem;
}

.lprof-prose p:last-child {
    margin-bottom: 0;
}

/* Procedures checklist (only rendered when the stored text is one item per
   line; a single-line value falls back to a paragraph — see procedure_lines). */
.lprof-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.5rem 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.lprof-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.925rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.lprof-check {
    flex: 0 0 auto;
    margin-top: 0.15rem;
    color: var(--lprof-primary);
    font-size: 0.95rem;
}

/* ==========================================================================
   4. Reviews
   ========================================================================== */

.lprof-rev-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    background: var(--lprof-bg);
    border: 1px solid var(--lprof-border);
    border-radius: var(--lprof-r);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.lprof-rev-score {
    flex: 0 0 auto;
    text-align: center;
    min-width: 120px;
}

.lprof-rev-avg {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.lprof-rev-score .lprof-stars {
    justify-content: center;
    margin: 0.35rem 0 0.3rem;
}

.lprof-rev-total {
    font-size: 0.825rem;
    color: var(--lprof-gray);
}

.lprof-rev-bars {
    flex: 1 1 220px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.lprof-rev-bar {
    display: grid;
    grid-template-columns: 2.4rem minmax(0, 1fr) 1.75rem;
    align-items: center;
    gap: 0.5rem;
}

.lprof-rev-bar-star {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    font-size: 0.8rem;
    color: var(--lprof-gray);
}

.lprof-rev-bar-star .bi-star-fill {
    color: var(--lprof-star);
    font-size: 0.7rem;
}

.lprof-rev-bar-track {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: #f3f4f6;
    overflow: hidden;
}

.lprof-rev-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--lprof-star);
}

.lprof-rev-bar-n {
    font-size: 0.8rem;
    color: var(--lprof-gray);
    text-align: right;
}

/* The template leaves this empty for a rating nobody gave. */
.lprof-rev-bar-n:empty::after {
    content: "0";
}

/* An inset card: the section around it is already white, so a second white box
   would read as a rendering artefact rather than a card. */
.lprof-card {
    background: var(--lprof-bg);
    border: 1px solid var(--lprof-border);
    border-radius: var(--lprof-r);
    padding: 1.25rem;
}

.lprof-review-form {
    margin-bottom: 1.25rem;
}

.lprof-review-form .lprof-sub-title {
    margin-top: 0;
}

.lprof-review-form .form-control-modern,
.lprof-review-form textarea,
.lprof-review-form input[type="file"] {
    max-width: 100%;
}

.lprof-reviews {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lprof-review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.lprof-review-who {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.lprof-review-author {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.lprof-review-score {
    font-size: 0.825rem;
    color: var(--lprof-gray);
}

.lprof-review-date {
    font-size: 0.8rem;
    color: var(--lprof-light);
    white-space: nowrap;
}

.lprof-review-text {
    font-size: 0.925rem;
}

.lprof-review-doc {
    margin-top: 0.75rem;
}

/* ==========================================================================
   5. Right rail
   ========================================================================== */

.lprof-price-card {
    position: sticky;
    top: calc(var(--app-header-h) + 20px);
    z-index: 0;
    background: var(--lprof-white);
    border: 1px solid var(--lprof-border);
    border-radius: var(--lprof-r-lg);
    box-shadow: var(--lprof-shadow-md);
    padding: 20px;
}

.lprof-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem;
}

.lprof-price-secondary {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--lprof-border);
}

.lprof-price-label {
    font-size: 0.85rem;
    color: var(--lprof-gray);
}

.lprof-price-value {
    font-size: 1.35rem;
    font-weight: 700;
    white-space: nowrap;
}

.lprof-price-secondary .lprof-price-value {
    font-size: 1rem;
}

.lprof-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    margin-top: 1rem;
}

.lprof-contacts {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--lprof-border);
}

.lprof-contacts-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lprof-light);
    margin: 0 0 0.75rem;
}

.lprof-contact {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.9rem;
    line-height: 1.45;
    margin-bottom: 0.65rem;
    min-width: 0;
}

.lprof-contact:last-child {
    margin-bottom: 0;
}

.lprof-contact i {
    flex: 0 0 auto;
    margin-top: 0.15rem;
    color: var(--lprof-primary);
    font-size: 0.95rem;
}

.lprof-contact a,
.lprof-contact span {
    color: var(--lprof-text);
    text-decoration: none;
    overflow-wrap: anywhere;
    min-width: 0;
}

.lprof-contact a:hover,
.lprof-contact a:focus-visible {
    color: var(--lprof-primary);
    text-decoration: underline;
}

.lprof-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--lprof-border);
}

.lprof-share-label {
    font-size: 0.8rem;
    color: var(--lprof-gray);
    margin-right: 0.2rem;
}

.lprof-share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid var(--lprof-border);
    background: var(--lprof-bg);
    color: var(--lprof-gray);
    font-size: 0.95rem;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.lprof-share-icon:hover,
.lprof-share-icon:focus-visible {
    background: var(--lprof-primary);
    border-color: var(--lprof-primary);
    color: #fff;
}

/* Opaque, and a layer above the pinned price card: these scroll over it. */
.lprof-rail-block {
    position: relative;
    z-index: 1;
    background: var(--lprof-white);
    border: 1px solid var(--lprof-border);
    border-radius: var(--lprof-r-lg);
    box-shadow: var(--lprof-shadow-sm);
    padding: 20px;
    scroll-margin-top: var(--lprof-anchor-offset);
}

.lprof-rail-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.9rem;
}

/* The Q&A cards keep their existing `lawyer-qa-*` styling from style.css; only
   the heading needs re-sizing now that it is an <h2> in a card of our own. */
.lprof-qa .lawyer-qa-sidebar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--lprof-text);
    margin: 0;
}

.lprof-article-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lprof-article + .lprof-article {
    border-top: 1px solid var(--lprof-border);
    padding-top: 1rem;
}

.lprof-article-cover {
    display: block;
    margin-bottom: 0.6rem;
    border-radius: var(--lprof-r);
    overflow: hidden;
}

.lprof-article-cover img {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.lprof-article-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 0.4rem;
}

.lprof-article-title a {
    color: var(--lprof-text);
    text-decoration: none;
}

.lprof-article-title a:hover,
.lprof-article-title a:focus-visible {
    color: var(--lprof-primary);
}

.lprof-article-excerpt {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--lprof-gray);
    margin: 0 0 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lprof-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.775rem;
    color: var(--lprof-light);
}

.lprof-article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* ==========================================================================
   6. Responsive — 1440 / 1024 / 768 / 390
   ========================================================================== */

@media (max-width: 1199.98px) {
    .lprof-page {
        --lprof-rail-w: 300px;
        --lprof-gap: 20px;
    }

    .lprof-name {
        font-size: 1.5rem;
    }
}

@media (max-width: 991.98px) {
    /* One column. `display: contents` promotes the rail's children to grid
       items so the price card (the call to action) can lead, then the reading
       column, then answers and articles. */
    .lprof-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .lprof-rail {
        display: contents;
    }

    .lprof-price-card {
        position: static;
        order: 1;
    }

    .lprof-main {
        order: 2;
    }

    .lprof-rail-block {
        order: 3;
    }
}

@media (max-width: 767.98px) {
    .lprof-hero {
        padding: 18px;
        gap: 18px;
    }

    .lprof-hero-photo,
    .lprof-hero-photo img,
    .lprof-hero-initials {
        width: 112px;
        height: 112px;
    }

    .lprof-hero-initials {
        font-size: 2rem;
    }

    .lprof-name {
        font-size: 1.35rem;
    }

    .lprof-section,
    .lprof-price-card,
    .lprof-rail-block {
        padding: 18px;
    }

    .lprof-checklist {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 575.98px) {
    .lprof-hero {
        gap: 14px;
        padding: 16px;
    }

    .lprof-hero-photo,
    .lprof-hero-photo img,
    .lprof-hero-initials {
        width: 84px;
        height: 84px;
        border-radius: var(--lprof-r);
    }

    .lprof-hero-initials {
        font-size: 1.5rem;
    }

    .lprof-name {
        font-size: 1.2rem;
    }

    .lprof-secnav {
        padding: 4px;
    }

    .lprof-secnav-link {
        padding: 0.45rem 0.65rem;
        font-size: 0.85rem;
    }

    .lprof-rev-summary {
        gap: 1rem;
        padding: 1rem;
    }

    .lprof-rev-score {
        min-width: 0;
        flex: 1 1 100%;
        text-align: left;
        display: flex;
        align-items: baseline;
        gap: 0.6rem;
    }

    .lprof-rev-score .lprof-stars {
        margin: 0;
    }

    .lprof-rev-avg {
        font-size: 1.75rem;
    }

    .lprof-section,
    .lprof-price-card,
    .lprof-rail-block {
        padding: 16px;
    }

    .lprof-card {
        padding: 1rem;
    }
}

/* Anyone who has asked for less motion gets none of the hover transitions. */
@media (prefers-reduced-motion: reduce) {
    .lprof-chip,
    .lprof-secnav-link,
    .lprof-share-icon {
        transition: none;
    }
}

@media print {
    .lprof-price-card {
        position: static;
        box-shadow: none;
    }

    .lprof-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .lprof-secnav,
    .lprof-share {
        display: none;
    }
}
