/* ==========================================================================
   3D Gem Studio
   ========================================================================== */
:root { --velvet: #07090d; }
:root[data-theme="light"] { --velvet: #ebe4d6; }

/* ---------- 1 · Cinematic hero (always a dark studio) ---------- */
.hero3d { position: relative; height: calc((var(--count, 5) + 0.6) * 100vh); background: #050506; color: #ece7de;
  --text: #ece7de; --text-2: #c3beb5; --muted: #9b9ea9; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14); --gold: #d4af6a; --gold-2: #f1d79a; }
.hero3d__sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.hero3d__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s ease; }
.hero3d.is-ready .hero3d__canvas { opacity: 1; }
.hero3d__loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: #8d8a83; transition: opacity .6s; }
.hero3d__loading span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(212,175,106,.25); border-top-color: #d4af6a; animation: spin360 1s linear infinite; }
@keyframes spin360 { to { transform: rotate(360deg); } }
.hero3d.is-ready .hero3d__loading { opacity: 0; pointer-events: none; }

.hero3d__ui { position: relative; z-index: 2; height: 100%; pointer-events: none; }
.hv { position: absolute; left: 0; top: 50%; width: min(440px, 42vw); transform: translateY(-46%); opacity: 0; visibility: hidden;
  transition: opacity .8s var(--ease), transform 1s var(--ease), visibility 0s .8s; }
.hv.is-on { opacity: 1; visibility: visible; transform: translateY(-50%); transition-delay: .15s, .15s, 0s; pointer-events: auto; }
.hv__num { display: block; font: 500 .78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .2em; color: #8d8a83; margin-bottom: 22px; }
.hv__num b { color: #d4af6a; }
.hv h1, .hv h2 { font-size: clamp(2.8rem, 1.6rem + 4vw, 5.6rem); line-height: .98; margin-bottom: 22px; font-weight: 400; }
.hv h1 em, .hv h2 em { color: #f1d79a; }
.hv__meta { color: #b9b4ab; font-size: 1rem; margin-bottom: 22px; }
.hv__meta b { color: #fff; font-weight: 600; }
.hv__photos { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.hv__photos a { width: 62px; height: 62px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); transition: transform .3s var(--ease), border-color .3s; }
.hv__photos a:hover { transform: translateY(-3px); border-color: #d4af6a; }
.hv__photos img { width: 100%; height: 100%; object-fit: cover; }
.hv__real { margin-left: 6px; font-size: .66rem; line-height: 1.35; letter-spacing: .12em; text-transform: uppercase; color: #7f7c76; }
.hv .link-arrow { color: #d4af6a; }

.hero3d__index { position: absolute; right: 0; top: 50%; transform: translateY(-50%); list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.hero3d__index li { display: flex; align-items: center; justify-content: flex-end; gap: 12px; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: #6f6c66; transition: color .4s; }
.hero3d__index li i { order: 2; width: 18px; height: 1px; background: currentColor; transition: width .5s var(--ease), background .4s; }
.hero3d__index li.is-on { color: #f1d79a; }
.hero3d__index li.is-on i { width: 42px; background: #d4af6a; }
.hero3d__note { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2; margin: 0; width: min(620px, calc(100% - 32px)); text-align: center; font-size: .72rem; color: #6f6c66; }
.hero3d__scroll { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 2; display: grid; justify-items: center; gap: 8px; font-size: .66rem; letter-spacing: .24em; text-transform: uppercase; color: #8d8a83; transition: opacity .5s; }
.hero3d__scroll span { position: relative; width: 1px; height: 34px; background: rgba(255,255,255,.14); overflow: hidden; }
.hero3d__scroll span::after { content: ''; position: absolute; left: 0; top: -10px; width: 1px; height: 10px; background: #d4af6a; animation: hint 1.8s ease-in-out infinite; }
@keyframes hint { to { top: 34px; } }
.hero3d__scroll.is-hidden { opacity: 0; }

/* ---------- 2 · Size explorer ---------- */
.explorer__lead { max-width: 420px; margin: 0; }
.explorer { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--line-2); border-radius: 22px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.explorer__stage { position: relative; min-height: 420px; background: var(--velvet); }
.explorer__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.explorer__badge { position: absolute; left: 16px; top: 16px; padding: 6px 12px; border-radius: 8px; font: 600 .78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--line-2); backdrop-filter: blur(6px); }
.explorer__panel { padding: 28px; display: flex; flex-direction: column; gap: 4px; }
.explorer__panel .field > span { display: flex; justify-content: space-between; }
.explorer__panel .field > span b { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; text-transform: none; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-2); }
.seg button { padding: 9px 0; border: 0; border-radius: 9px; background: none; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--muted); transition: background .25s, color .25s; }
.seg button.is-on { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--line-2), 0 4px 12px -6px rgba(0,0,0,.4); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; padding: 0; border: 0; box-shadow: none; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold) var(--fill, 36%), var(--line-2) var(--fill, 36%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); cursor: grab; }
input[type=range]:focus { box-shadow: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--gold); outline-offset: 3px; }
.range-scale { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: -2px; }
.range-scale i { font-style: normal; }
.readout { display: grid; grid-template-columns: repeat(3, 1fr); margin: 6px 0 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.readout div { padding: 12px 14px; border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
.readout div:last-child { border-right: 0; }
.readout .readout__main { grid-column: 1 / -1; border-top: 0; border-right: 0; background: var(--bg-2); }
.readout dt { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.readout dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.readout__main dd { font-size: 1rem; color: var(--muted); }
.readout__main b { font-family: var(--serif); font-size: 3rem; font-weight: 500; color: var(--gold-2); line-height: 1; margin-right: 4px; }
.stock-match { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); background: color-mix(in srgb, var(--gold) 8%, transparent); font-size: .9rem; transition: background .2s; }
.stock-match:hover { background: color-mix(in srgb, var(--gold) 16%, transparent); }
.stock-match b { font-size: 1.1rem; color: var(--gold-2); }
.stock-match .ic { color: var(--gold); }
.explorer__note { margin: 12px 0 0; }

/* ---------- 3 · Palette ring ---------- */
.palette { position: relative; height: min(520px, 70vh); border-radius: 26px; overflow: hidden; background: var(--velvet); border: 1px solid var(--line-2); cursor: grab; touch-action: pan-y; }
.palette:active { cursor: grabbing; }
.palette canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.palette__label {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: grid; justify-items: center; gap: 2px;
  padding: 10px 22px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--line-2); backdrop-filter: blur(8px);
}
.palette__label b { font-family: var(--serif); font-size: 1.6rem; font-weight: 500; line-height: 1.1; }
.palette__label span { font-size: .78rem; color: var(--gold); }
.palette__list { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.palette__list a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: .82rem; transition: border-color .2s; }
.palette__list a:hover { border-color: var(--gold); }
.palette__list i { width: 9px; height: 9px; border-radius: 2px; transform: rotate(45deg); }
.palette__list em { font-style: normal; color: var(--muted); font-size: .75rem; }

.no-webgl .hero3d { height: auto; }
.no-webgl .hero3d__sticky { position: relative; height: auto; padding: 120px 0 80px; }
.no-webgl .hv { position: relative; top: auto; transform: none; opacity: 1; visibility: visible; width: auto; margin-bottom: 56px; pointer-events: auto; }
.no-webgl .hero3d__index, .no-webgl .hero3d__loading, .no-webgl .hero3d__scroll, .no-webgl .hero3d__canvas { display: none; }
.no-webgl .explorer__stage, .no-webgl .palette { display: none; }
.no-webgl .explorer { grid-template-columns: 1fr; }
.studio-fallback { padding: 40px 0; color: var(--muted); }

@media (max-width: 900px) {
  .hv { top: auto; bottom: 92px; width: auto; right: 0; transform: translateY(14px); }
  .hv.is-on { transform: none; }
  .hv h1, .hv h2 { font-size: 2.6rem; margin-bottom: 12px; }
  .hv__meta { font-size: .9rem; margin-bottom: 14px; }
  .hv__photos { margin-bottom: 14px; }
  .hv__photos a { width: 48px; height: 48px; }
  .hero3d__index { display: none; }
  .hero3d__scroll { display: none; }
  .hero3d__ui::before { content: ''; position: absolute; left: -16px; right: -16px; bottom: 0; height: 58vh; background: linear-gradient(transparent, rgba(5,5,6,.9) 40%); }
  .explorer { grid-template-columns: 1fr; }
  .explorer__stage { min-height: 320px; }
  .explorer__panel { padding: 20px; }
  .readout__main b { font-size: 2.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hv { transition: none; }
}

.seg--4 { grid-template-columns: repeat(4, 1fr); }
.explorer__hint { position: absolute; right: 16px; bottom: 14px; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
