/* ============================================
   BREADCRUMB SECTION (Above Page Header)
   A tonal orientation strip — Mineral White surface, hairline border,
   shadow appears only on interaction (Shadow-Is-State Rule).
   ============================================ */

.breadcrumb-section {
    position: relative;
    padding: 1rem 0 0 0;
    z-index: 10;
}

/* Sunken/raised strip conveys depth tonally, not via a rest shadow. */
.breadcrumb-wrapper {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 0.875rem 1.5rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Hairline underline accent — the only resting detail. */
.breadcrumb-wrapper::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background-color: var(--border-color);
    opacity: 0.6;
    border-radius: var(--radius-xs);
}

/* Interaction earns a Lift shadow (Shadow-Is-State). The wrapper itself is
   informational chrome; it deepens its border and gains a soft shadow on
   hover instead of lifting off the page (No-Lift-Reflex). */
.breadcrumb-wrapper:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.breadcrumb-section .breadcrumb {
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.125rem;
}

.breadcrumb-section .breadcrumb-item {
    display: inline-flex;
    align-items: center;
    font-size: var(--fs-subtitle);
    font-weight: 500;
    padding: 0;
    transition: color 0.3s ease;
}

/* Separator chevron: a single source SVG, flipped via transform in RTL
   instead of re-declaring the mask four times. */
.breadcrumb-section .breadcrumb-item + .breadcrumb-item::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin: 0 0.125rem;
    flex-shrink: 0;
    background-color: var(--primary-color);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.breadcrumb-section .breadcrumb-item:hover + .breadcrumb-item::before {
    opacity: 1;
    transform: translateX(3px);
}

.breadcrumb-section .breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.175rem 0.375rem;
    border-radius: var(--radius-md);
    transition: color 0.3s ease, background-color 0.3s ease;
    position: relative;
}

.breadcrumb-section .breadcrumb-item a:hover {
    color: var(--primary-color);
    background-color: var(--surface-sunken);
}

/* Visible focus ring on every interactive element (Kelp Teal, never removed). */
.breadcrumb-section .breadcrumb-item a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

.breadcrumb-section .breadcrumb-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Non-clickable entry: a menu heading (group label) with no destination.
   Styled like a normal ancestor link but never interactive. */
.breadcrumb-section .breadcrumb-item.breadcrumb-item-nolink {
    color: var(--text-muted);
    cursor: default;
    padding: 0.175rem 0.375rem;
}

/* Breadcrumb Home Icon */
.breadcrumb-section .breadcrumb-item:first-child a {
    display: inline-flex;
    align-items: center;
    gap: 0.175rem;
}

.breadcrumb-section .breadcrumb-item:first-child a i {
    font-size: var(--fs-label);
    transition: transform 0.3s ease;
}

.breadcrumb-section .breadcrumb-item:first-child a:hover i {
    transform: scale(1.2);
}

/* Breadcrumb Dark Mode
   Light/dark separation is handled entirely by the token cascade —
   --card-bg, --border-color, --text-muted, --primary-color all re-point
   under [data-bs-theme="dark"], so the strip recolors automatically. */
html[data-bs-theme="dark"] .breadcrumb-wrapper:hover {
    box-shadow: var(--shadow);
}

/* Breadcrumb RTL — flip the separator by mirroring the same icon, avoiding
   a second inline SVG declaration. */
html[dir="rtl"] .breadcrumb-section .breadcrumb-item + .breadcrumb-item::before {
    transform: scaleX(-1);
}

html[dir="rtl"] .breadcrumb-section .breadcrumb-item:hover + .breadcrumb-item::before {
    transform: scaleX(-1) translateX(-3px);
}

/* Breadcrumb Responsive */
@media (max-width: 768px) {
    .breadcrumb-section {
        padding: 0.75rem 0;
    }

    .breadcrumb-wrapper {
        padding: 0.75rem 1rem;
        border-radius: var(--radius-lg);
    }

    .breadcrumb-section .breadcrumb-item {
        font-size: 0.8rem;
    }

    .breadcrumb-section .breadcrumb-item + .breadcrumb-item::before {
        width: 16px;
        height: 16px;
        margin: 0 0.25rem;
    }
}

/* Motion sensitivity — preserve state change (color/background shift) while
   removing the translate/scale transforms that disturb vestibular-sensitive
   users. The hover affordance stays legible through color alone. */
@media (prefers-reduced-motion: reduce) {
    .breadcrumb-wrapper,
    .breadcrumb-section .breadcrumb-item,
    .breadcrumb-section .breadcrumb-item + .breadcrumb-item::before,
    .breadcrumb-section .breadcrumb-item a,
    .breadcrumb-section .breadcrumb-item:first-child a i {
        transition: none;
    }

    .breadcrumb-section .breadcrumb-item:hover + .breadcrumb-item::before,
    .breadcrumb-section .breadcrumb-item:first-child a:hover i {
        transform: none;
    }
}
