/* Build Guide — Foto-annotaties + Pin Tooltip Systeem */

/* ============================================================
   SECTIE 1: guide-photo — foto-container met SVG pin-overlay
   ============================================================ */

.guide-photo {
    margin: clamp(12px, 2vw, 16px) 0 8px;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
}

/* Relative wrapper zodat de SVG-overlay absoluut gepositioneerd kan worden */
.guide-photo__wrapper {
    position: relative;
    display: block;
    line-height: 0;
}

.guide-photo__img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* SVG-overlay over de foto — pointer-events uit op het vlak zelf */
.guide-photo__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Pin-groep binnen de SVG: pointer-events aan voor interactie */
.guide-photo__pin {
    pointer-events: auto;
    cursor: pointer;
}

/* Pin-cirkel met drop-shadow en hover-scale */
.guide-photo__pin circle {
    fill: var(--accent);
    stroke: #fff;
    stroke-width: 0.8;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    transition: filter 0.15s, transform 0.15s;
    transform-origin: center;
    transform-box: fill-box;
}

.guide-photo__pin:hover circle,
.guide-photo__pin:focus circle {
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.7));
    transform: scale(1.18);
}

/* Cijfer-label binnen de pin — niet klikbaar/selecteerbaar */
.guide-photo__pin text {
    fill: #fff;
    font-size: 2.8px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    font-family: system-ui, sans-serif;
    pointer-events: none;
    user-select: none;
}

/* Onderschrift onder de foto */
.guide-photo__caption {
    padding: clamp(6px, 1.5vw, 8px) clamp(10px, 2vw, 12px);
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    line-height: 1.4;
}

/* ============================================================
   SECTIE 2: guide-photo__legend — genummerde legenda onder foto
   ============================================================ */

.guide-photo__legend {
    margin: 8px 0 clamp(12px, 2vw, 16px);
    padding-left: 0;
    list-style: none;
    counter-reset: legend-counter;
}

.guide-photo__legend li {
    counter-increment: legend-counter;
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 2px;
    padding: 2px 0;
}

/* Genummerd bolletje via CSS counter — zelfde kleur als SVG-pin */
.guide-photo__legend li::before {
    content: counter(legend-counter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    cursor: pointer;
}

/* Legend-items als klikbare button (opent popover via Alpine) */
.guide-photo__legend button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    line-height: 1.5;
    transition: color 0.12s;
}

.guide-photo__legend button:hover {
    color: var(--accent);
}

/* ============================================================
   SECTIE 3: guide-pin-popover — zwevende tooltip (Alpine-driven)
   Desktop: fixed, gepositioneerd naast de pin via Alpine.js
   Mobile (<600px): bottom-sheet (zie sectie 5)
   Zichtbaar via .is-open class
   ============================================================ */

.guide-pin-popover {
    display: none;
    position: fixed;
    z-index: 150000;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    box-shadow: var(--shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.25));
    padding: clamp(12px, 2vw, 14px) clamp(14px, 2vw, 16px) clamp(10px, 1.5vw, 12px);
    max-width: min(300px, calc(100vw - 32px));
    width: max-content;
}

.guide-pin-popover.is-open {
    display: block;
}

/* Header: badge + titel + sluitknop naast elkaar */
.guide-pin-popover__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

/* Genummerd bolletje in popover-header */
.guide-pin-popover__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.guide-pin-popover__title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    line-height: 1.3;
}

/* Sluitknop rechtsboven in popover */
.guide-pin-popover__close {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm, 4px);
    flex-shrink: 0;
    transition: color 0.12s, background 0.12s;
    padding: 0;
}

.guide-pin-popover__close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* Bodytekst van de popover */
.guide-pin-popover__body {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

/* ============================================================
   SECTIE 4: guide-pin-link — inline klikbare pin-referentie
   Gebruik in stap-tekst: "Sluit de 24-pin connector aan <a class="guide-pin-link">pin 3</a>"
   ============================================================ */

.guide-pin-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted color-mix(in srgb, var(--accent) 60%, transparent);
    transition: border-bottom-color 0.12s;
}

.guide-pin-link:hover {
    border-bottom-color: var(--accent);
}

/* Klein badge-bolletje naast het linktekst */
.guide-pin-link__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 1;
}

/* ============================================================
   SECTIE 5: Mobile bottom-sheet + dark mode + print
   ============================================================ */

/* Op smalle schermen: popover wordt een bottom-sheet */
@media (max-width: 600px) {
    .guide-pin-popover.is-open {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0 !important;
        padding: 20px 16px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Dark mode: pin-stroke iets meer doorschijnend wit voor contrast op donkere foto's */
html.dark .guide-photo__pin circle {
    stroke: rgba(255, 255, 255, 0.9);
}

/* Print: verberg popover, bewaar SVG pin-kleuren in afdruk */
@media print {
    .guide-pin-popover {
        display: none !important;
    }

    .guide-photo__overlay {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ============================================================
   SECTIE 6: guide-substep-photo — inklapbare foto per sub-stap
   Gebruik: pkb_guide_substep_photo([...]) binnen een <li>
   ============================================================ */

.guide-substep-photo {
    margin-top: clamp(8px, 1.5vw, 12px);
}

.guide-substep-photo__toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 100px;
    cursor: pointer;
    padding: 3px 10px 3px 8px;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
    font-family: inherit;
}

.guide-substep-photo__toggle:hover {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.guide-substep-photo__chevron {
    transition: transform 0.2s;
}

.guide-substep-photo__chevron--open {
    transform: rotate(180deg);
}

/* CSS Grid expand/collapse — geen max-height hack nodig */
.guide-substep-photo__content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}

.guide-substep-photo__content.is-open {
    grid-template-rows: 1fr;
}

.guide-substep-photo__inner {
    overflow: hidden;
    min-height: 0;
}

.guide-substep-photo__inner > .guide-photo {
    margin-top: 8px;
}

.guide-substep-photo__inner > .guide-photo__legend {
    margin-bottom: 4px;
}

/* ============================================================
   SECTIE 7: guide-step__banner — altijd-zichtbare bannerfoto
   ============================================================ */

.guide-step__banner {
    margin-bottom: clamp(12px, 2vw, 16px);
}

.guide-step__banner > .guide-photo {
    margin-top: 0;
}
