/* HomePod Deconstruction wiki page. This file loads before site-shell.css, so rules that compete
   with shell selectors such as .site-shell .site-content p repeat that prefix. */

.hp-viewer {
    --hp-width: max(100%, min(1040px, calc(100vw - 96px)));
    width: var(--hp-width);
    margin: 2rem 0 0 calc((100% - var(--hp-width)) / 2);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "controls" "info";
    gap: 18px;
}

.hp-viewer [hidden] { display: none !important; }

.hp-stage {
    grid-area: stage;
    position: relative;
    height: clamp(380px, 68vh, 680px);
    border: 1px solid #373630;
    border-radius: 8px;
    background: radial-gradient(120% 85% at 50% 38%, #262520 0%, #1e1d1b 55%, #1b1a18 100%);
    overflow: hidden;
    scroll-margin-top: 16px;
}

.hp-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    outline: none;
}
.hp-stage canvas:active { cursor: grabbing; }
.hp-stage canvas.is-hovering { cursor: pointer; }
.hp-stage canvas:focus-visible { outline: 2px solid #aaa69d; outline-offset: -2px; }

.hp-labels { position: absolute; inset: 0; pointer-events: none; }

.hp-label {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: auto;
    padding: 3px 9px;
    border: 1px dashed #9a968c;
    border-radius: 999px;
    background: rgba(27, 26, 24, 0.88);
    color: #eeeae3;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
}
.hp-label:hover,
.hp-label[aria-pressed="true"] { border-color: #eeeae3; }
.hp-label[aria-pressed="true"] { border-style: solid; }

.hp-tooltip {
    position: absolute;
    left: 0;
    top: 0;
    max-width: 240px;
    padding: 6px 10px;
    border: 1px solid #45453d;
    border-radius: 6px;
    background: rgba(27, 26, 24, 0.94);
    font-size: 12px;
    line-height: 1.45;
    pointer-events: none;
}
.hp-tooltip strong { display: block; font-weight: 600; color: #eeeae3; }
.hp-tooltip span { display: block; color: #aaa69d; }

.hp-loading,
.hp-fallback,
.hp-noscript {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px;
    text-align: center;
}
.hp-noscript { background: #1e1d1b; }
.site-shell .site-content :is(.hp-loading, .hp-fallback p, .hp-noscript) {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}
.site-shell .site-content .hp-fallback p:first-child { max-width: 34ch; color: var(--text); }

.hp-controls {
    grid-area: controls;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hp-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.hp-button {
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid #45453d;
    border-radius: 7px;
    background: #22231f;
    color: #eeeae3;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
}
.hp-button:hover:not(:disabled) { border-color: #77756b; }
.hp-button[aria-pressed="true"] { background: #eeeae3; border-color: #eeeae3; color: #1b1a18; }
.hp-button:disabled { opacity: 0.45; cursor: not-allowed; }

.hp-slider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}
.hp-slider input { flex: 1 1 auto; min-width: 120px; max-width: 360px; accent-color: #aaa69d; }
.site-shell .hp-slider input:focus-visible { outline: 2px solid #c5cbb1; outline-offset: 4px; }
.hp-slider output { min-width: 3.2em; color: var(--text); font-variant-numeric: tabular-nums; }

.site-content .hp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.site-content .hp-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.hp-swatch { flex: none; width: 18px; height: 12px; border-radius: 2px; }
.hp-swatch-documented { background: #8d897f; }
.hp-swatch-uncertain {
    border: 1px dashed #d8d4ca;
    background: repeating-linear-gradient(135deg, rgba(232, 228, 218, 0.7) 0 1.5px, transparent 1.5px 4.5px);
}

.site-shell .site-content .hp-help {
    max-width: 66ch;
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.hp-info {
    grid-area: info;
    padding-top: 16px;
    border-top: 1px solid #373630;
}
.site-shell .site-content .hp-info-status {
    display: inline-block;
    margin: 0 0 8px;
    padding: 1px 9px;
    border: 1px solid #45453d;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.site-shell .site-content .hp-info-status[data-status="uncertain"] { border-style: dashed; border-color: #9a968c; color: var(--text); }
.site-shell .site-content .hp-info-name {
    margin: 0 0 10px;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}
.site-shell .site-content .hp-info-body p { margin: 0 0 10px; font-size: 14px; line-height: 1.65; }

@media (min-width: 900px) {
    .hp-viewer {
        grid-template-columns: minmax(0, 1fr) 300px;
        grid-template-rows: auto 1fr;
        grid-template-areas: "stage info" "controls info";
        column-gap: 28px;
    }
    .hp-info {
        position: relative;
        min-height: 240px;
        padding-top: 0;
        border-top: 0;
        border-left: 1px solid #373630;
    }
    /* Long part notes scroll inside the panel instead of stretching the grid below the stage. */
    .hp-info-inner {
        position: absolute;
        inset: 0 0 0 24px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #45453d transparent;
    }
}

.site-content .hp-viewer + .section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid #222; }

.site-content .hp-group {
    margin: 2rem 0 0.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.site-content .hp-parts { margin: 0 0 1rem; padding: 0; list-style: none; }
.site-content .hp-part {
    margin: 0;
    padding: 14px 0;
    border-bottom: 1px solid #2c2b27;
    scroll-margin-top: 16px;
}

.hp-part-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 14px;
}

.site-shell .site-content .hp-part-name {
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: #5f5d56;
    text-underline-offset: 4px;
    cursor: pointer;
}
.site-shell .site-content .hp-part-name:hover,
.site-shell .site-content .is-selected .hp-part-name { text-decoration-color: currentColor; }
.site-shell .site-content .is-selected .hp-part-name { text-decoration-thickness: 2px; }

.hp-status {
    flex: none;
    padding: 1px 9px;
    border: 1px solid #45453d;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: nowrap;
}
.hp-part[data-status="uncertain"] .hp-status { border-style: dashed; border-color: #9a968c; color: var(--text); }

.site-shell .site-content .hp-part-body p { margin: 8px 0 0; font-size: 0.98rem; line-height: 1.7; }
.site-shell .site-content .hp-note { color: var(--text-secondary); }

.site-shell .site-content a.hp-cite {
    color: var(--text-secondary);
    text-decoration-color: #5f5d56;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.site-content .hp-sources { margin: 0 0 1rem; padding-left: 1.6rem; list-style: decimal; }
.site-content .hp-sources li { margin: 0 0 0.9rem; padding-left: 0.3rem; scroll-margin-top: 16px; }
.hp-sources li::marker { color: var(--text-secondary); }
.hp-accessed { color: var(--text-secondary); }

.site-content .hp-sources li:target,
.site-content .hp-part:target { outline: 1px dashed #8d897f; outline-offset: 6px; }

@media (max-width: 600px) {
    .hp-stage { height: clamp(340px, 62vh, 520px); }
    .hp-button { min-height: 44px; }
    .hp-slider input { max-width: none; }
}
