/* Public /resources/lien-waivers page.
   Built on the --th-* tokens defined in css/public/modern.css; this file only adds
   the components that page needs (filter pills, state cards, detail modal, role tabs). */

.lw-stat {
    background: var(--th-bg);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    padding: 1rem 1.25rem;
    flex: 1 1 140px;
}

.lw-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--th-primary);
}

.lw-stat-value.lw-stat-accent { color: var(--th-accent-text, #8a6519); }

.lw-stat-label {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--th-text-muted);
}

/* The chart card sits inside .modern-hero, whose h2/p rules force white text with
   !important for the dark background. Everything inside this white card has to
   claw its own color back. */
.lw-chart-card {
    /* Series colors live here so the CSS legend and the Chart.js dataset read from
       one source; lien-waivers.js pulls them off this element at draw time. */
    --lw-series-statutory: #009fe3;
    --lw-series-statutory-hover: #0077b3;
    --lw-series-unregulated: #64748b;
    --lw-series-unregulated-hover: #475569;

    background: var(--th-bg);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-lg);
    box-shadow: var(--th-shadow-lg);
    padding: 1.75rem;
}

.lw-chart-card .lw-chart-title {
    color: var(--th-text) !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-align: center;
    margin-bottom: 1.25rem;
}

.lw-chart-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    height: 300px;
    margin: 0 auto;
}

/* Readout in the doughnut hole: the point of the chart at a glance, so the reader
   does not have to measure an arc against a legend. */
.lw-chart-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}

.lw-chart-center-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--lw-series-statutory);
}

.lw-chart-center-label {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--th-text-muted);
}

.lw-legend {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lw-legend-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--th-radius-sm);
    background: var(--th-bg-alt);
}

.lw-legend-swatch {
    flex: 0 0 auto;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 3px;
}

.lw-legend-swatch-statutory { background: var(--lw-series-statutory); }
.lw-legend-swatch-unregulated { background: var(--lw-series-unregulated); }

.lw-legend-text {
    flex: 1 1 auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--th-text) !important;
}

.lw-legend-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--th-text) !important;
    font-variant-numeric: tabular-nums;
}

.lw-chart-card .lw-chart-note {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--th-text-light) !important;
}

/* Filter bar ------------------------------------------------------------- */

.lw-toolbar {
    background: var(--th-bg);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    box-shadow: var(--th-shadow);
    padding: 1.25rem;
}

.lw-search {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: var(--th-bg-alt);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    color: var(--th-text);
    transition: var(--th-transition-fast);
}

.lw-search:focus {
    outline: none;
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px var(--th-primary-ultra-light);
}

.lw-filter {
    padding: 0.55rem 1.1rem;
    border-radius: var(--th-radius-sm);
    border: 1px solid var(--th-border);
    background: var(--th-bg);
    color: var(--th-text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--th-transition-fast);
}

.lw-filter:hover { background: var(--th-bg-alt); }

.lw-filter[aria-pressed="true"] {
    background: var(--th-text);
    border-color: var(--th-text);
    color: #fff;
}

/* State cards ------------------------------------------------------------ */

.lw-card {
    display: block;
    width: 100%;
    height: 100%;
    text-align: left;
    cursor: pointer;
    background: var(--th-bg);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    padding: 1.5rem;
    transition: var(--th-transition);
}

.lw-card:hover,
.lw-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--th-primary-light);
    box-shadow: var(--th-shadow-lg);
}

/* The Porto theme sets h3 { text-transform: uppercase; font-size: 1.7rem } with
   !important site-wide. These headings are body copy, not section titles, so every
   override below has to match that specificity. */
.lw-card-name {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1.3;
    color: var(--th-text);
    margin: 0;
}

.lw-step-title {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1.3;
    color: var(--th-text);
    margin: 0;
}

.lw-modal-title {
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    text-transform: none !important;
    letter-spacing: -0.01em !important;
    color: var(--th-text);
    margin: 0 0 0.35rem;
}

.lw-card-code {
    font-weight: 700;
    color: var(--th-text-light);
}

.lw-card-nuance {
    font-size: 0.875rem;
    color: var(--th-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lw-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: var(--th-radius-pill);
}

.lw-badge-statutory { background: var(--th-primary-ultra-light); color: var(--th-primary-dark); }
.lw-badge-notary { background: #f3e8ff; color: #6b21a8; }
.lw-badge-advance { background: var(--th-accent-ultra-light); color: var(--th-accent-text, #8a6519); }
.lw-badge-doc { background: #e7f6ec; color: #17612f; }

.lw-empty {
    /* Direct child of a Bootstrap .row (flexbox), so this spans the line by basis. */
    flex: 0 0 100%;
    max-width: 100%;
    padding: 3rem 0;
    text-align: center;
    color: var(--th-text-light);
}

/* Detail modal ----------------------------------------------------------- */

.lw-modal {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.6);
}

.lw-modal[hidden] { display: none; }

.lw-modal-dialog {
    background: var(--th-bg);
    border-radius: var(--th-radius-lg);
    box-shadow: var(--th-shadow-xl);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lw-modal-header {
    background: var(--th-primary);
    border-bottom: 1px solid var(--th-primary);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.lw-modal-body {
    padding: 1.75rem;
    overflow-y: auto;
}

.lw-modal-body::-webkit-scrollbar { width: 6px; }
.lw-modal-body::-webkit-scrollbar-track { background: var(--th-bg-alt); }
.lw-modal-body::-webkit-scrollbar-thumb { background: var(--th-border); border-radius: var(--th-radius-pill); }

.lw-modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--th-text-light);
    padding: 0 0.25rem;
}

.lw-modal-close:hover { color: var(--th-text); }

.lw-modal-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--th-text-light);
}

.lw-fact {
    background: var(--th-bg-alt);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    padding: 0.9rem 1rem;
    height: 100%;
}

/* borders match the badge colours so the badge tells you where to look, and only
   light up when this state actually carries that flag */
.lw-fact-statutory.lw-fact-on { border-color: var(--th-primary); }
.lw-fact-notary.lw-fact-on { border-color: #6b21a8; }
.lw-fact-advance.lw-fact-on { border-color: var(--th-accent, #d9a441); }

.lw-deep {
    background: var(--th-accent-ultra-light);
    border: 1px solid var(--th-accent-light);
    border-radius: var(--th-radius-sm);
    padding: 1rem;
}

.lw-doc-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    color: var(--th-text);
    font-weight: 600;
    transition: var(--th-transition-fast);
}

.lw-doc-link {
    border-color: var(--th-primary);
}

.lw-doc-link:hover {
    border-color: var(--th-primary-dark);
    color: var(--th-primary-dark);
}

/* Role tabs -------------------------------------------------------------- */

.lw-tabs {
    display: inline-flex;
    gap: 0.25rem;
    background: var(--th-bg-subtle);
    border-radius: var(--th-radius-sm);
    padding: 0.25rem;
}

.lw-tab {
    border: none;
    background: none;
    padding: 0.5rem 1.5rem;
    border-radius: var(--th-radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--th-text-muted);
    transition: var(--th-transition-fast);
}

.lw-tab[aria-selected="true"] {
    background: var(--th-bg);
    color: var(--th-primary);
    box-shadow: var(--th-shadow);
}

.lw-step {
    background: var(--th-bg);
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    padding: 1.5rem;
    height: 100%;
}

.lw-step-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.lw-step-num {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--th-radius-sm);
    background: var(--th-primary-ultra-light);
    color: var(--th-primary);
    font-size: 1.15rem;
    font-weight: 700;
}

/* the block text here was `small` and unreadable at the bottom of a long page */
.lw-step-body {
    font-size: 0.95rem;
    line-height: 1.6;
}

#lw-panel-sub .lw-step-num { background: #f3e8ff; color: #6b21a8; }

@media (max-width: 575.98px) {
    .lw-chart-container { max-width: 240px; height: 240px; }
    .lw-chart-center-value { font-size: 2.25rem; }
    .lw-modal-body { padding: 1.25rem; }
}

/* CTA -------------------------------------------------------------------- */

.lw-cta-title {
    max-width: 20ch;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 575.98px) {
    .lw-cta-title {
        font-size: 1.6rem;
        max-width: none;
    }

    /* "by email" drops to its own line instead of the heading shrinking further */
    .lw-cta-break {
        display: block;
        height: 0;
    }
}

.lw-modal-header .lw-modal-title,
.lw-modal-header .lw-modal-close {
    color: #fff;
}

.lw-modal-header .lw-modal-close:hover {
    color: #fff;
    opacity: 0.8;
}

/* the modal header is blue now, so the pale chips designed for a grey header
   would fade into it. Inside the header they read as white chips instead. */
.lw-modal-header .lw-badge {
    background: rgba(255, 255, 255, 0.92);
    color: var(--th-primary-dark);
}

.lw-modal-header .lw-badge-notary { color: #6b21a8; }
.lw-modal-header .lw-badge-advance { color: #8a6519; }

/* left aligned because it is a wall of block text, not a caption */
.lw-disclaimer {
    max-width: 780px;
    margin: 0 auto 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    text-align: left;
    color: var(--th-text-muted);
}
