/* The unit in 3D (solo-3d.html): the interactive model with a per-part colour picker.
   The white pages' language (body.hub: white, ink, one gold). The stage is light too - a warm
   studio sweep - because wood, brass and brushed metal read best on light, the way the
   product would be shot. Only this page loads it. */

.s3d { padding: clamp(36px, 5vw, 64px) 0 88px; }
/* The way back, above the title: quiet until wanted, but always the first thing in the reading order. */
.s3d__back {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 0 18px; padding: 10px 18px 10px 14px;
    border: 1px solid var(--hub-line); border-radius: 999px; background: #fff;
    color: var(--hub-muted); text-decoration: none; font-size: 15px; font-weight: 500; line-height: 1;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.s3d__back:hover, .s3d__back:focus-visible { color: var(--hub-gold); border-color: var(--hub-gold); background: var(--hub-tint); }
.s3d__back-arrow { font-size: 1.05rem; transition: transform .2s ease; }
.s3d__back:hover .s3d__back-arrow { transform: translateX(-3px); }

.s3d__head { max-width: 900px; margin: 0 auto 36px; text-align: center; }
.s3d__head .hub-h2 { margin-bottom: 18px; }
.s3d__head .hub-lede { max-width: 60ch; font-size: clamp(16px, 1.35vw, 19px); margin-bottom: 0; }

.s3d__layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start;
}

/* The stage: a warm studio sweep with a soft pool of light where the unit stands. */
.s3d__stage {
    position: relative; width: 100%; aspect-ratio: 4 / 3; min-height: 360px;
    border-radius: 26px; overflow: hidden;
    background:
        radial-gradient(55% 32% at 50% 82%, rgba(169, 131, 60, .14), transparent 70%),
        radial-gradient(110% 90% at 50% 20%, #ffffff, #f3efe7 62%, #e9e3d7);
    box-shadow: 0 34px 70px -40px rgba(20, 20, 26, .45), 0 0 0 1px var(--hub-line);
    touch-action: none;             /* one finger turns the model instead of scrolling the page */
    cursor: grab;
}
.s3d__stage:active { cursor: grabbing; }
.s3d__stage canvas { display: block; width: 100%; height: 100%; }

.s3d__status {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; pointer-events: none; text-align: center; padding: 24px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--hub-gold);
    transition: opacity .4s ease;
}
.s3d__status[hidden] { display: none; }
.s3d__status.is-fading { opacity: 0; }
.s3d__bar { width: 180px; height: 2px; background: rgba(20, 20, 26, .1); border-radius: 2px; overflow: hidden; }
.s3d__bar i { display: block; height: 100%; width: 0; background: var(--hub-gold); transition: width .25s ease; }
.s3d__status p { letter-spacing: 0; text-transform: none; font-family: inherit; color: var(--hub-muted); font-size: 13px; max-width: 420px; }
.s3d__status img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; z-index: -1; opacity: .55; }

.s3d__hint {
    position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
    padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(6px);
    box-shadow: 0 6px 18px -10px rgba(20, 20, 26, .4);
    font-size: 13px; font-weight: 500; color: var(--hub-ink); transition: opacity .6s ease;
}
.s3d__hint.is-hidden { opacity: 0; }

.s3d__controls { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; }
.s3d__iconbtn {
    -webkit-appearance: none; appearance: none; width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--hub-line); background: rgba(255, 255, 255, .85); color: var(--hub-ink);
    cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(8px);
    box-shadow: 0 6px 16px -10px rgba(20, 20, 26, .45);
    transition: border-color .2s, background-color .2s, color .2s, transform .12s ease;
}
.s3d__iconbtn:hover, .s3d__iconbtn:focus-visible { border-color: var(--hub-gold); color: var(--hub-gold); background: #fff; outline: none; }
.s3d__iconbtn:active { transform: scale(.94); }
.s3d__iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.s3d__iconbtn .when-on, .s3d__iconbtn[aria-pressed="true"] .when-off { display: none; }
.s3d__iconbtn[aria-pressed="true"] .when-on { display: block; }

/* The panel: parts list, then the colours for the selected part. */
.s3d__panel {
    border: 1px solid var(--hub-line); border-radius: 24px; padding: 22px; background: #fff;
    box-shadow: 0 1px 2px rgba(20, 20, 26, .04), 0 24px 48px -36px rgba(20, 20, 26, .4);
    max-height: calc(100vh - var(--hub-nav-h) - 40px); display: flex; flex-direction: column; gap: 16px;
    position: sticky; top: calc(var(--hub-nav-h) + 20px);
}
.s3d__panel h3 {
    margin: 0;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; font-weight: 500; color: var(--hub-gold);
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.s3d__panel h3 small { letter-spacing: 0; text-transform: none; font-family: inherit; color: var(--hub-muted); font-weight: 400; }

.s3d__parts { list-style: none; margin: 0; padding: 0; overflow: auto; min-height: 0; flex: 1 1 auto;
    scrollbar-width: thin; scrollbar-color: rgba(169, 131, 60, .35) transparent; }
.s3d__parts li { margin: 0 0 4px; }
.s3d__part {
    -webkit-appearance: none; appearance: none; width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
    font: inherit; font-size: 15px; font-weight: 500; color: var(--hub-ink); cursor: pointer;
    padding: 10px 12px; border-radius: 14px; border: 1px solid transparent; background: transparent;
    transition: border-color .2s, background-color .2s, transform .12s ease;
}
.s3d__part:hover { background: var(--hub-tint); }
.s3d__part:active { transform: scale(.98); }
.s3d__part[aria-pressed="true"] { border-color: var(--hub-gold); background: var(--hub-tint); }
.s3d__part:focus-visible { outline: 2px solid var(--hub-gold); outline-offset: 2px; }
.s3d__dot {
    width: 24px; height: 24px; border-radius: 50%; flex: none;
    box-shadow: inset 0 0 0 1px rgba(20, 20, 26, .14), inset -4px -5px 8px rgba(0,0,0,.28), inset 3px 4px 6px rgba(255,255,255,.3);
}
.s3d__part span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.s3d__colors[hidden] { display: none; }
.s3d__kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.s3d__kind {
    -webkit-appearance: none; appearance: none; font: inherit; font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 999px; cursor: pointer;
    color: var(--hub-muted); background: #fff; border: 1px solid var(--hub-line);
    transition: border-color .15s ease, background-color .15s ease, color .15s ease, transform .12s ease;
}
.s3d__kind:hover { border-color: rgba(169, 131, 60, .5); color: var(--hub-ink); }
.s3d__kind:active { transform: scale(.96); }
.s3d__kind[aria-pressed="true"] { border-color: var(--hub-gold); color: #fff; background: var(--hub-gold); }
.s3d__kind:focus-visible { outline: 2px solid var(--hub-gold); outline-offset: 2px; }
.s3d__dot[data-kind="wood"] { background-image: repeating-linear-gradient(180deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.22) 2px 3px); }
.s3d__dot[data-kind="brushed"] { background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0) 0 1px, rgba(255,255,255,.16) 1px 2px); }
.s3d__swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.s3d__swatch {
    -webkit-appearance: none; appearance: none; width: 38px; height: 38px; border-radius: 50%; border: 2px solid #fff; cursor: pointer;
    box-shadow: 0 0 0 1px var(--hub-line), inset -5px -6px 10px rgba(0,0,0,.32), inset 4px 5px 8px rgba(255,255,255,.25);
    transition: transform .15s ease, box-shadow .15s ease; padding: 0;
}
.s3d__swatch:hover { transform: scale(1.1); }
.s3d__swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--hub-gold), inset -5px -6px 10px rgba(0,0,0,.32), inset 4px 5px 8px rgba(255,255,255,.25); }
.s3d__swatch:focus-visible { outline: 2px solid var(--hub-gold); outline-offset: 2px; }
.s3d__swatch--led { background: radial-gradient(circle at 35% 30%, #9dffcb, #2bd97a 45%, #0f7a44); }

.s3d__custom { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--hub-muted); }
.s3d__colors > h3 { margin-bottom: 12px; }
.s3d__custom input[type="color"] {
    -webkit-appearance: none; appearance: none; width: 46px; height: 38px; padding: 0; border: 1px solid var(--hub-line);
    border-radius: 12px; background: #fff; cursor: pointer;
}
.s3d__custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.s3d__custom input[type="color"]::-webkit-color-swatch { border: none; border-radius: 8px; }
.s3d__custom input[type="color"]::-moz-color-swatch { border: none; border-radius: 8px; }

.s3d__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.s3d__btn {
    -webkit-appearance: none; appearance: none; font: inherit; font-size: 14px; font-weight: 500; min-height: 42px; padding: 9px 18px; border-radius: 999px;
    border: 1px solid var(--hub-line); background: #fff; color: var(--hub-ink); cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s, transform .12s ease;
}
.s3d__btn:hover { border-color: var(--hub-gold); background: var(--hub-tint); }
.s3d__btn:active { transform: scale(.96); }
.s3d__btn.is-done { border-color: var(--hub-gold); color: var(--hub-gold); }

.s3d__note { margin: 36px auto 0; max-width: 760px; text-align: center; font-size: 14px; line-height: 1.6; color: var(--hub-muted); }
.s3d__note a { color: var(--hub-gold); }

@media (min-width: 1301px) {
    .s3d__wrap { width: min(1560px, calc(100% - 64px)); }
}
@media (max-width: 900px) {
    .s3d { padding-top: 28px; }
    .s3d__wrap { width: calc(100% - 32px); }
    .s3d__layout { grid-template-columns: 1fr; }
    .s3d__stage { aspect-ratio: 1 / 1; min-height: 0; border-radius: 22px; }   /* a min-height here would force the width past the screen */
    .s3d__panel { position: static; max-height: none; }
    .s3d__parts { max-height: 240px; }
}
