/* ==========================================================================
   LIGHTHOUSE REPORT VIEWER (js/lighthouse-report.js)
   --------------------------------------------------------------------------
   The shell (backdrop, beam, stage, caption band, close button) is the
   image gallery's own .gallery styling in style-default.css, section 11.
   This file styles what goes inside it, in the folio's own language:
   NeueMachina figures, Aeonik labels, 1px hairlines with a bright lead-in
   (the caption band's), and a fine-outlined card like the "Check the numbers
   yourself" button. It holds the detail the case-study image doesn't:
   every request, and every audit.
   Load it after style-default.css.
   ========================================================================== */

/* the card: a fine outline on a solid ground */
.lh {
    --w-video: #e6e7ef;
    --w-fonts: #a6a8b9;
    --w-javascript: #8a8c9e;
    --w-css: #6b6d7f;
    --w-html: #a6a8b9;
    --w-imagery: #c8cad6;
    --w-other: #4f5161;

    grid-area: 1 / 1;
    box-sizing: border-box;
    width: min(1120px, 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: clamp(18px, 3vh, 30px) clamp(20px, 3vw, 40px) clamp(14px, 2.2vh, 22px);
    overflow: hidden;
    color: var(--g-text);
    background: #121316;   /* solid: nothing from the page shows through the card */
    border: 1px solid var(--g-line);
    border-radius: 14px;
    opacity: 0;
    translate: 0 14px;
    transition: opacity 0.35s ease, translate 0.45s var(--g-ease);
}

.lh.is-shown {
    opacity: 1;
    translate: 0 0;
}

.lh p,
.lh ul,
.lh li,
.lh h3,
.lh b {
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: left;
}

.lh button {
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.lh button:focus-visible,
.lh__body:focus-visible {
    outline: 2px solid var(--g-text);
    outline-offset: 3px;
}

/* "Loading..." and error text, in the same spot */
.lh__message {
    grid-area: 1 / 1;
    margin: 0;
    font: 14px/1.5 'Aeonik Light', sans-serif;
    letter-spacing: 0.04em;
    color: var(--g-muted);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.lh__message.is-shown { opacity: 1; }

/* ---- top: tabs and the headline facts ---------------------------------- */
.lh__top {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--g-line);
}

.lh__tabs {
    display: flex;
    gap: clamp(18px, 2.4vw, 32px);
}

.lh .lh__tab {
    position: relative;
    padding: 0 0 12px !important;
    margin-bottom: -13px;   /* sits on the hairline */
    font: 12px/1.3 'Aeonik Light', sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--g-muted) !important;
    transition: color 0.25s ease;
}

.lh__tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--g-text);
    scale: 0 1;
    transform-origin: left;
    transition: scale 0.4s var(--g-ease);
}

.lh__tab:hover { color: var(--g-text) !important; }
.lh__tab.is-on { color: var(--g-text) !important; }
.lh__tab.is-on::after { scale: 1 1; }

.lh__tab-n {
    margin-left: 8px;
    font-variant-numeric: tabular-nums;
    color: var(--g-muted);
    letter-spacing: 0.06em;
}

.lh__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 0;
    font: 12px/1.3 'Aeonik Light', sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--g-muted);
}

.lh__facts span + span::before {
    content: '\00b7';
    margin: 0 10px;
}

/* ---- the scrolling area ------------------------------------------------- */
.lh__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(230, 231, 239, 0.3) transparent;
    margin: 0 -8px;
    padding: 0 8px;
}

.lh__foot {
    margin-top: 12px;
    font: 12px/1.5 'Aeonik Light', sans-serif;
    letter-spacing: 0.03em;
    color: var(--g-muted);
}

.lh .lh__run {
    flex: none;
    font: 12px/1.5 'Aeonik Light', sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--g-muted);
}

/* ---- every request ------------------------------------------------------ */
.lh__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 0 14px;
}

.lh .lh__chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px !important;
    font: 12px/1.2 'Aeonik Light', sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--g-muted) !important;
    border: 1px solid var(--g-line) !important;
    border-radius: 999px;
    transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.lh__chip:hover { color: var(--g-text) !important; border-color: rgba(230, 231, 239, 0.5) !important; }

.lh__chip.is-on {
    color: var(--g-text) !important;
    border-color: var(--g-text) !important;
    background: rgba(230, 231, 239, 0.08) !important;
}

.lh__chip-n { font-variant-numeric: tabular-nums; opacity: 0.7; }

.lh__tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px 78px 88px minmax(120px, 190px);
    align-items: center;
    gap: 0 clamp(12px, 1.8vw, 24px);
    padding: 9px 0;
    border-bottom: 1px solid var(--g-line);
    font: 14px/1.3 'Aeonik Light', sans-serif;
    letter-spacing: 0.02em;
}

.lh__tr--head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 0;
    background: #121316;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--g-muted);
}

.lh__sort {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: var(--g-muted) !important;
    transition: color 0.25s ease;
}

.lh__sort:hover,
.lh__sort.is-on { color: var(--g-text) !important; }

.lh__arrow { color: var(--g-text); min-width: 0.8em; }

.lh__num { text-align: right; font-variant-numeric: tabular-nums; }
.lh__th.lh__num { text-align: right; }
.lh__th.lh__num .lh__sort { justify-content: flex-end; }
.lh__num--dim { color: var(--g-muted); }

.lh__file {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    overflow-wrap: anywhere;
}

.lh__dir { color: var(--g-muted); }
.lh__name { color: var(--g-text); }

.lh__tag {
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--g-muted);
    font-style: italic;
}

.lh__type {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--g-muted);
}

.lh__share {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* the bar: a thin line, scaled against the biggest file */
.lh__bar {
    position: relative;
    flex: 1 1 auto;
    height: 4px;
    background: rgba(230, 231, 239, 0.08);
}

.lh__bar::after {
    content: '';
    position: absolute;
    inset: 0;
    width: calc(var(--w, 0) * 100%);
    background: var(--bar, var(--g-muted));
}

.lh__bar--video      { --bar: var(--w-video); }
.lh__bar--fonts      { --bar: var(--w-fonts); }
.lh__bar--javascript { --bar: var(--w-javascript); }
.lh__bar--css        { --bar: var(--w-css); }
.lh__bar--html       { --bar: var(--w-html); }
.lh__bar--imagery    { --bar: var(--w-imagery); }
.lh__bar--other      { --bar: var(--w-other); }

.lh__pct {
    flex: none;
    min-width: 3.6em;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--g-muted);
}

.lh__tr--foot {
    border-bottom: 0;
    color: var(--g-text);
}

.lh__tr--foot .lh__file { color: var(--g-muted); }

.lh__tr.is-cancelled { color: var(--g-muted); }
.lh__tr.is-cancelled .lh__name { color: var(--g-muted); }

.lh__dot {
    flex: none;
    width: 8px;
    height: 8px;
    background: var(--dot, var(--g-muted));
}

.lh__dot--video      { --dot: var(--w-video); }
.lh__dot--fonts      { --dot: var(--w-fonts); }
.lh__dot--javascript { --dot: var(--w-javascript); }
.lh__dot--css        { --dot: var(--w-css); }
.lh__dot--imagery    { --dot: var(--w-imagery); }
.lh__dot--other      { --dot: var(--w-other); }
.lh__dot--html       { background: transparent; box-shadow: inset 0 0 0 1px var(--w-html); }

/* ---- every audit -------------------------------------------------------- */
.lh__audits {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 clamp(18px, 2.6vw, 36px);
    align-items: start;
}

.lh__col {
    min-width: 0;
    padding-top: 14px;
    border-top: 1px solid var(--g-line);
    background: linear-gradient(var(--g-text), var(--g-text)) left top / 40px 1px no-repeat;
}

.lh__col-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.lh .lh__heading {
    margin: 0;
    font: 12px/1.3 'Aeonik Light', sans-serif;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--g-text);
}

.lh .lh__heading::before,
.lh .lh__heading::after { content: none; }

.lh__score {
    font: 28px/1 'NeueMachina-Regular', sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--g-text);
}

.lh__list li {
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr);
    gap: 2px 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--g-line);
    font: 14px/1.35 'Aeonik Light', sans-serif;
    letter-spacing: 0.02em;
}

.lh__mark {
    width: 8px;
    height: 8px;
    margin-top: 0.45em;
    background: var(--g-text);
}

.lh__list .is-flag .lh__mark {
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--g-text);
}

.lh__t { color: var(--g-text); }
.lh__list .is-pass .lh__t { color: var(--g-muted); }
.lh__d { grid-column: 2; color: var(--g-muted); }

/* ---- narrower windows --------------------------------------------------- */
@media (max-width: 980px) {
    .lh__audits { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
}

@media (max-width: 720px) {
    .lh__tr { grid-template-columns: minmax(0, 1fr) 70px 78px; }
    .lh__tr > :nth-child(2),
    .lh__tr > :nth-child(5) { display: none; }   /* type and share go; the file and its sizes stay */
    .lh__facts { display: none; }
}

@media (max-width: 520px) {
    .lh { padding: 16px 14px 12px; border-radius: 12px; }
    .lh__audits { grid-template-columns: minmax(0, 1fr); }
    .lh__run { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .lh,
    .lh__message { transition: none; translate: none; }
    .lh__tab::after { transition: none; }
}
