/* Mountain jewellery (/gifts/jewelry/). The preview sits on a dark velvet
   tray, the panel stays quiet; champagne gold is the only accent. */

.jw {
    --tray: #1b1a20;
    --tray-hi: #2a2731;
    --panel: #141416;
    --field: #1e1e22;
    --ink: #eeebe5;
    --muted: #a19d96;
    --rule: rgba(238, 235, 229, 0.09);
    --gold: #d9b77e;
    --gold-hi: #e8cb98;
    --warn: #f0b36e;
    font-family: 'Schibsted Grotesk', system-ui, sans-serif;
    color: var(--ink);
    max-width: 1560px;
    margin: 0 auto;
    padding: 14px 24px 56px;
}
.jw h1, .jw h2, .jw h3 { font-family: inherit; color: var(--ink); }
.jw-intro { padding: 18px 0 16px; border-bottom: 1px solid var(--rule); }
.jw-intro h1 {
    font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; font-size: 2.6rem;
    letter-spacing: -0.01em; line-height: 0.95; margin: 0 0 10px;
}
.jw-intro p { color: var(--muted); font-size: 0.93rem; line-height: 1.5; margin: 0; }

.jw-app { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 20px; align-items: start; }

/* ---------- the tray ---------- */
.jw-tray {
    position: sticky; top: 68px;
    display: flex; flex-direction: column;
    height: calc(100vh - 84px); min-height: 600px;
    background: #121115; border-radius: 14px; overflow: hidden;
}
.jw-pano { padding: 12px 14px 4px; }
.jw-panohead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; min-height: 1.3em; }
.jw-panotitle { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.jw-panoread { font-size: 0.78rem; color: var(--muted); text-align: right; }
.jw-panobox { position: relative; border-radius: 8px; overflow: hidden; background: #0e0d11; }
.jw-panobox canvas { display: block; width: 100%; height: clamp(130px, 22vh, 210px); cursor: crosshair; }
.jw-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.06); }
.jw-progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.15s; }

.jw-stagebar { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px 0; flex-wrap: wrap; }
.jw-stage {
    position: relative; flex: 1; min-height: 0; margin: 8px 10px 0; border-radius: 10px; overflow: hidden;
    background:
        radial-gradient(ellipse 70% 60% at 50% 55%, var(--tray-hi) 0%, var(--tray) 60%, #141318 100%);
}
.jw-stage::after {
    /* velvet nap */
    content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
    background-image: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 5px);
}
.jw-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; z-index: 1; }
.jw-stage canvas:active { cursor: grabbing; }
.jw-stage-note {
    position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); margin: 0; z-index: 2;
    color: var(--muted); font-size: 0.9rem; text-align: center; max-width: 80%;
}
.jw-scale {
    position: absolute; left: 14px; bottom: 12px; z-index: 2; pointer-events: none;
    font-size: 0.74rem; color: rgba(238, 235, 229, 0.6);
}
.jw-status { margin: 0; padding: 9px 14px 11px; font-size: 0.8rem; color: rgba(238, 235, 229, 0.62); min-height: 2.4em; }

/* ---------- segmented controls ---------- */
.jw-seg { display: inline-flex; background: var(--field); border-radius: 9px; padding: 3px; gap: 2px; }
.jw-seg button {
    border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.86rem; font-weight: 500;
    padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.jw-seg button:hover { color: var(--ink); }
.jw-seg button[aria-pressed="true"] { background: var(--ink); color: #161519; }
.jw-seg-dark { background: rgba(255, 255, 255, 0.05); }
.jw-seg-dark button { font-size: 0.8rem; padding: 5px 10px; }
.jw-seg-dark button i {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.jw-seg-wrap { flex-wrap: wrap; }
.jw-sec .jw-seg { display: flex; }
.jw-sec .jw-seg button { flex: 1; }
.jw-sec .jw-seg + .jw-seg, .jw-sec .jw-seg + .jw-search, .jw-mt { margin-top: 8px; }

/* ---------- panel ---------- */
.jw-panel { background: var(--panel); border-radius: 14px; padding: 4px 18px 18px; }
.jw-sec { padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
.jw-sec:last-child { border-bottom: 0; }
.jw-sec h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
.jw-sec h3 { font-size: 0.9rem; font-weight: 600; margin: 16px 0 8px; }
.jw-sub { margin: 14px 0 8px; font-size: 0.86rem; color: var(--muted); }
.jw-hint { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }
.jw-hint:empty { display: none; }
.jw-readout { font-size: 0.84rem; margin: 8px 0 0; color: var(--ink); line-height: 1.45; }
.jw-readout small { color: var(--muted); font-size: 0.78rem; }
.jw-warn { font-size: 0.8rem; color: var(--warn); margin: 8px 0 0; line-height: 1.4; }

.jw-search { display: flex; gap: 6px; }
.jw-search input, .jw-field input, .jw-field select {
    width: 100%; min-width: 0; background: var(--field); color: var(--ink); border: 1px solid transparent; border-radius: 8px;
    padding: 8px 10px; font: inherit; font-size: 0.9rem;
}
.jw-field select { appearance: auto; }
.jw-search input:focus, .jw-field input:focus, .jw-field select:focus { outline: none; border-color: var(--gold); }
.jw-results { list-style: none; margin: 6px 0 0; padding: 0; }
.jw-results button {
    display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); font: inherit;
    padding: 7px 8px; border-radius: 7px; cursor: pointer;
}
.jw-results button:hover, .jw-results button:focus-visible { background: var(--field); }
.jw-results strong { display: block; font-size: 0.9rem; font-weight: 600; }
.jw-results span { display: block; font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jw-res-note { font-size: 0.8rem; color: var(--muted); padding: 6px 8px; }

.jw-mapwrap { position: relative; margin-top: 10px; border-radius: 8px; overflow: hidden; background: var(--field); }
.jw-map { width: 100%; height: 290px; }
.jw-mapwrap .maplibregl-ctrl-attrib { font-size: 10px; }
.jw-pin {
    width: 18px; height: 18px; border-radius: 50%; background: var(--gold); border: 2px solid #1a1814;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); cursor: grab;
}
.jw-pin-eye { width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; color: #1a1814; }
.jw-pin-dir { width: 14px; height: 14px; background: #fff; }
.jw-pin-b { background: #fff; }

.jw-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.jw .jw-ex {
    display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 8px; border-radius: 999px; border: 0;
    background: var(--field); color: var(--ink); font: inherit; font-size: 0.82rem; cursor: pointer;
}
.jw .jw-ex:hover { background: #2a2a30; }
.jw-ex svg { width: 22px; height: 12px; flex: none; }
.jw-ex[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--gold); }

.jw-field { display: block; margin: 10px 0 0; }
.jw-field > span, .jw-range > span { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.jw-range output { color: var(--ink); }
.jw-range { display: block; margin: 12px 0 4px; }
.jw-range input { width: 100%; accent-color: var(--gold); }
/* size section: label and output on one line */
.jw-only-flat .jw-range { display: grid; grid-template-columns: 1fr auto; align-items: baseline; }
.jw-only-flat .jw-range > span { margin: 0; }
.jw-only-flat .jw-range input { grid-column: 1 / -1; margin-top: 4px; }
.jw-only-flat .jw-range output { font-size: 0.8rem; }
.jw-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.jw-check-row { display: flex; align-items: center; gap: 9px; font-size: 0.88rem; margin: 12px 0 0; cursor: pointer; }
.jw-check-row input { accent-color: var(--gold); width: 16px; height: 16px; margin: 0; flex: none; }
.jw-link { background: none; border: 0; padding: 0; margin-top: 10px; color: var(--muted); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
.jw-link:hover { color: var(--ink); }
.jw-link-inline { margin: 0 0 8px; justify-self: start; }

.jw-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid rgba(238, 235, 229, 0.2); background: transparent; color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 600;
    padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.jw-btn:hover { border-color: var(--ink); }
.jw-btn-main { background: var(--gold); border-color: var(--gold); color: #1d170c; }
.jw-btn-main:hover { background: var(--gold-hi); border-color: var(--gold-hi); }
.jw-btn:disabled { opacity: 0.6; cursor: progress; }
.jw-btn:focus-visible, .jw-seg button:focus-visible, .jw-link:focus-visible, .jw-ex:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.jw-license a { color: var(--gold); }
.jw-dl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.jw-facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 0.86rem; }
.jw-facts dt { color: var(--muted); font-weight: 400; }
.jw-facts dd { margin: 0; }
.jw-facts .is-ok { color: #9fd8b0; }
.jw-facts .is-bad { color: var(--warn); }

/* which controls show for which piece */
.jw:not([data-piece="ring"]) .jw-only-ring,
.jw[data-piece="ring"] .jw-only-flat,
.jw[data-src="area"] .jw-only-profile,
.jw:not([data-src="view"]) .jw-only-view,
.jw:not([data-src="line"]) .jw-only-line,
.jw:not([data-src="area"]) .jw-only-area,
.jw:not([data-rs="outer"]) .jw-only-outer,
.jw:not([data-pair="1"]) .jw-only-pair { display: none !important; }

/* ---------- about ---------- */
.jw-about { margin-top: 44px; max-width: 1180px; }
.jw-about h2 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 2rem; font-weight: 600; margin-bottom: 16px; }
.jw-about-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 40px; }
.jw-about h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.jw-about p { color: var(--muted); font-size: 0.92rem; line-height: 1.6; margin: 0; max-width: 60ch; }
.jw-credit { margin-top: 22px !important; font-size: 0.82rem !important; }

.jw-toast {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
    width: max-content; max-width: calc(100vw - 32px);
    background: var(--ink); color: #161519; padding: 10px 16px; border-radius: 9px; font-size: 0.9rem; font-weight: 500;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

@media (max-width: 1100px) {
    .jw-app { grid-template-columns: minmax(0, 1fr) 350px; }
}
@media (max-width: 900px) {
    .jw { padding: 14px 16px 44px; }
    .jw-app { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .jw-tray { position: relative; top: 0; height: auto; min-height: 0; }
    .jw-stage { flex: none; height: 360px; }
    .jw-about-cols { grid-template-columns: 1fr; gap: 18px; }
    /* intro above the preview, control sections below it */
    .jw-panel { display: contents; }
    .jw-intro { order: -1; border: 0; padding: 6px 2px 4px; }
    .jw-intro h1 { font-size: 2.2rem; }
    .jw-sec { order: 1; background: var(--panel); border-radius: 12px; padding: 14px; border: 0; }
    .jw-map { height: 260px; }
}
@media (max-width: 420px) {
    .jw-seg button { padding: 6px 8px; font-size: 0.82rem; }
    .jw-seg-dark button { padding: 5px 7px; }
}
@media (prefers-reduced-motion: reduce) {
    .jw-progress i { transition: none; }
}
