/* ── F-House design tokens ───────────────────────────────────── */
:root {
    --fh-gold:    #c8a050;
    --fh-gold-lt: #e8c66a;
    --fh-dark:    #1a1a2e;
    --fh-navy:    #0f3460;
    --fh-cream:   #f8f4ed;
    --fh-white:   #ffffff;
}

/* ── Issue card grid ─────────────────────────────────────────── */
.fhig-grid {
    display: grid;
    gap: 20px;
    margin: 24px 0;
}
.fhig-grid-1 { grid-template-columns: 1fr; }
.fhig-grid-2 { grid-template-columns: repeat(2, 1fr); }
.fhig-grid-3 { grid-template-columns: repeat(3, 1fr); }
.fhig-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
    .fhig-grid-3, .fhig-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .fhig-grid-2, .fhig-grid-3, .fhig-grid-4 { grid-template-columns: 1fr; }
}

/* ── Issue card ──────────────────────────────────────────────── */
.fhig-card {
    background: var(--fh-white);
    border-radius: 10px;
    border: 1.5px solid #e8e4de;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.fhig-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.12); transform: translateY(-2px); }
.fhig-card--critical { border-left: 4px solid #c00; }
.fhig-card--high     { border-left: 4px solid #c05000; }
.fhig-card--medium   { border-left: 4px solid #a07000; }
.fhig-card--low      { border-left: 4px solid #2d7d2d; }

.fhig-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fhig-sev-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}
.fhig-sev-badge--critical { background: #fdecea; color: #c00; border: 1px solid #fcc; }
.fhig-sev-badge--high     { background: #fdf0ea; color: #c05000; border: 1px solid #f9c; }
.fhig-sev-badge--medium   { background: #fdf8ea; color: #a07000; border: 1px solid #e8d890; }
.fhig-sev-badge--low      { background: #edf8ed; color: #2d7d2d; border: 1px solid #b0dcb0; }

.fhig-cat-badge {
    font-size: 11px;
    background: var(--fh-cream);
    color: var(--fh-navy);
    border: 1px solid #e0ddd8;
    border-radius: 20px;
    padding: 2px 10px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.fhig-cat-badge:hover {
    background: var(--fh-navy);
    color: #fff;
    border-color: var(--fh-navy);
}

/* ── Issue card title (clickable) ────────────────────────────── */
.fhig-card__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--fh-dark);
    margin: 0;
    line-height: 1.4;
}
.fhig-card__title--link {
    cursor: pointer;
    transition: color .15s;
}
.fhig-card__title--link:hover { color: var(--fh-navy); text-decoration: underline; }
.fhig-card__title--link:focus {
    outline: 2px solid var(--fh-gold);
    outline-offset: 2px;
    border-radius: 3px;
}

.fhig-card__path {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.fhig-sep { color: var(--fh-gold); font-weight: 700; }

.fhig-card__desc { font-size: 13px; color: #555; line-height: 1.6; }
.fhig-card__desc p { margin: 0 0 6px; }
.fhig-card__desc p:last-child { margin: 0; }

.fhig-card__detail { display: flex; flex-direction: column; gap: 10px; }
.fhig-card__block {
    background: var(--fh-cream);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
}
.fhig-block--signs  { border-left: 3px solid var(--fh-navy); }
.fhig-block--avoid  { border-left: 3px solid #2d7d2d; }
.fhig-card__block strong { display: block; margin-bottom: 4px; font-size: 12px; color: #555; }
.fhig-card__block p { margin: 0; color: #333; line-height: 1.5; }

.fhig-card__tags { display: flex; flex-wrap: wrap; gap: 5px; }
.fhig-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #f0ede6;
    border: 1px solid #d8d4ca;
    border-radius: 3px;
    font-size: 11px;
    color: #666;
}

.fhig-card__related { font-size: 13px; }
.fhig-card__related ul { margin: 4px 0 0 16px; padding: 0; }
.fhig-card__related li { margin-bottom: 2px; color: #555; }
.fhig-empty { color: #999; font-style: italic; }
.fhig-single { margin: 24px 0; }

/* ── Lightbox overlay ────────────────────────────────────────── */
@keyframes fhigFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fhigSlideUp { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

.fhig-lb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(10,10,25,.78);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.fhig-lb-overlay.fhig-lb-open {
    display: flex;
    animation: fhigFadeIn .18s ease;
}

.fhig-lb-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 620px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
    animation: fhigSlideUp .22s ease;
    scrollbar-width: thin;
}

/* ── Image area ──────────────────────────────────────────────── */
.fhig-lb-img-wrap {
    position: relative;
    height: 220px;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    flex-shrink: 0;
}
.fhig-lb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fhig-lb-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fhig-lb-img-placeholder::after {
    content: attr(data-icon);
    font-size: 56px;
    opacity: .35;
}
.fhig-lb-img-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Lightbox severity badge ─────────────────────────────────── */
.fhig-lb-sev-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    backdrop-filter: blur(4px);
}
.fhig-lb-sev--critical { background: rgba(200,0,0,.3); color: #fdd; border: 1px solid rgba(200,0,0,.5); }
.fhig-lb-sev--high     { background: rgba(200,80,0,.3); color: #fdb; border: 1px solid rgba(200,80,0,.5); }
.fhig-lb-sev--medium   { background: rgba(160,112,0,.3); color: #fed; border: 1px solid rgba(160,112,0,.5); }
.fhig-lb-sev--low      { background: rgba(45,125,45,.3); color: #cfc; border: 1px solid rgba(45,125,45,.5); }

.fhig-lb-cat-overlay {
    font-size: 11px;
    color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 20px;
    padding: 3px 11px;
    backdrop-filter: blur(4px);
}

/* ── Lightbox body ───────────────────────────────────────────── */
.fhig-lb-body {
    padding: 22px 24px 28px;
}
.fhig-lb-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--fh-dark);
    margin: 0 0 8px;
    line-height: 1.35;
    padding-right: 32px;
}
.fhig-lb-path {
    font-size: 12px;
    color: var(--fh-gold);
    font-weight: 600;
    letter-spacing: .02em;
    margin-bottom: 14px;
}
.fhig-lb-path::before { content: '›› '; }

.fhig-lb-desc {
    font-size: 14px;
    color: #444;
    line-height: 1.7;
    margin-bottom: 16px;
}

.fhig-lb-section {
    background: var(--fh-cream);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.fhig-lb-section--signs { border-left: 3px solid var(--fh-navy); }
.fhig-lb-section--avoid { border-left: 3px solid #2d7d2d; }
.fhig-lb-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #444;
    margin: 0 0 8px;
    display: block;
}
.fhig-lb-list {
    margin: 0;
    padding: 0 0 0 18px;
    list-style: disc;
}
.fhig-lb-list li {
    font-size: 13px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 4px;
}
.fhig-lb-list li:last-child { margin: 0; }

/* ── Close button ────────────────────────────────────────────── */
.fhig-lb-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(0,0,0,.12);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    transition: background .15s;
    color: #333;
}
.fhig-lb-close:hover { background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.2); }

/* ── Loading state ───────────────────────────────────────────── */
.fhig-lb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #888;
    font-size: 14px;
    gap: 10px;
}
.fhig-lb-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0ddd8;
    border-top-color: var(--fh-gold);
    border-radius: 50%;
    animation: fhigSpin .7s linear infinite;
}
@keyframes fhigSpin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
    .fhig-lb-modal { border-radius: 12px; max-height: 96vh; }
    .fhig-lb-img-wrap { height: 180px; }
    .fhig-lb-body { padding: 16px 18px 22px; }
    .fhig-lb-title { font-size: 17px; }
}

/* ── Graph wrapper ───────────────────────────────────────────── */
.fhig-graph-wrap {
    background: var(--fh-dark);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin: 24px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
}

/* ── Tabs ────────────────────────────────────────────────────── */
.fhig-tabs {
    display: flex;
    background: rgba(0,0,0,.3);
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.fhig-tab {
    padding: 12px 22px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,.55);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s, border-bottom .15s;
    border-bottom: 3px solid transparent;
    letter-spacing: .02em;
}
.fhig-tab:hover { color: rgba(255,255,255,.8); }
.fhig-tab--active {
    color: var(--fh-gold-lt);
    border-bottom-color: var(--fh-gold);
}

/* ── Legend ──────────────────────────────────────────────────── */
.fhig-legend {
    position: absolute;
    top: 50px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 10;
    background: rgba(0,0,0,.5);
    border-radius: 6px;
    padding: 8px 12px;
}
.fhig-leg-node, .fhig-leg-edge {
    font-size: 11px;
    color: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    gap: 5px;
}
.fhig-leg-path  { color: #e8c66a; }
.fhig-leg-issue { color: #88c0d0; }
.fhig-leg-hier  { color: rgba(255,255,255,.5); }
.fhig-leg-rel   { color: #c8a050; }

/* ── SVG panes ───────────────────────────────────────────────── */
.fhig-pane { position: relative; }
.fhig-force-svg,
.fhig-tree-svg {
    display: block;
    width: 100%;
    height: var(--fhig-h, 520px);
    cursor: grab;
}
.fhig-force-svg:active,
.fhig-tree-svg:active { cursor: grabbing; }

/* ── Tooltip ─────────────────────────────────────────────────── */
.fhig-tooltip {
    position: absolute;
    background: rgba(0,0,0,.85);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    max-width: 220px;
    line-height: 1.5;
    z-index: 100;
    display: none;
    border: 1px solid rgba(200,160,80,.4);
}

/* ── Detail panel (graph) ────────────────────────────────────── */
.fhig-detail-panel {
    position: absolute;
    top: 44px;
    right: 0;
    width: 300px;
    max-height: calc(var(--fhig-h, 520px) - 44px);
    background: rgba(15,52,96,.96);
    border-left: 1px solid rgba(200,160,80,.3);
    overflow-y: auto;
    z-index: 50;
    backdrop-filter: blur(8px);
}
.fhig-detail-close {
    position: sticky;
    top: 0;
    float: right;
    background: rgba(0,0,0,.3);
    border: none;
    color: #fff;
    font-size: 18px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 0 6px;
}
.fhig-detail-body {
    padding: 14px 16px;
    clear: both;
}
.fhig-detail-body h4 {
    margin: 0 0 10px;
    color: var(--fh-gold-lt);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}
.fhig-detail-body .fhig-dp-path {
    font-size: 11px;
    color: rgba(255,255,255,.5);
    margin-bottom: 10px;
}
.fhig-detail-body .fhig-dp-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    margin-bottom: 10px;
    font-weight: 600;
}
.fhig-dp-badge--critical { background: rgba(200,0,0,.25); color: #faa; border: 1px solid rgba(200,0,0,.4); }
.fhig-dp-badge--high     { background: rgba(200,80,0,.25); color: #fdba; border: 1px solid rgba(200,80,0,.4); }
.fhig-dp-badge--medium   { background: rgba(160,112,0,.25); color: #fdb; border: 1px solid rgba(160,112,0,.4); }
.fhig-dp-badge--low      { background: rgba(45,125,45,.25); color: #afa; border: 1px solid rgba(45,125,45,.4); }
.fhig-detail-body p { color: rgba(255,255,255,.75); font-size: 12px; line-height: 1.6; margin: 0 0 8px; }
.fhig-detail-body .fhig-dp-section {
    background: rgba(0,0,0,.25);
    border-radius: 5px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 12px;
    color: rgba(255,255,255,.7);
}
.fhig-detail-body .fhig-dp-section strong { display: block; color: var(--fh-gold); margin-bottom: 4px; }
.fhig-detail-body .fhig-dp-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.fhig-detail-body .fhig-dp-tag {
    padding: 2px 8px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 3px;
    font-size: 11px;
    color: rgba(255,255,255,.6);
}

@media (max-width: 640px) {
    .fhig-detail-panel { width: 100%; position: relative; border-left: none; border-top: 1px solid rgba(200,160,80,.3); }
}
