/* Layout: a 3D bench stage beside a control column, then three study sections (light, cut grade, symmetry).
   Palette follows the JewelLoop site: white paper, black ink, ruby accent, gold for returned light. */
:root {
  --paper: #ffffff;
  --ink: #16161a;
  --ink-soft: #3d3d45;
  --muted: #6b6b75;
  --rule: #e4e2de;
  --mist: #f4f3f1;
  --ruby: #9b1b30;
  --gold: #b8892f;
  --leak: #c2410c;
  --good: #2f7d4f;
  --warn: #b7791f;
  --bad: #b42318;
  --stage-top: #e6e3dc;
  --stage-bottom: #c9c4b9;
  --table-c: #1f5fbf;
  --culet-c: #c2410c;
  --outline-c: #2f7d4f;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  --paper: #121216; --ink: #f1efe9; --ink-soft: #c9c6bf; --muted: #9a978f; --rule: #2c2c33;
  --mist: #1b1b21; --ruby: #e0566c; --gold: #e1b25a; --leak: #f08a4b; --good: #5fbf86; --warn: #e3a948; --bad: #f0695c;
  --stage-top: #24242b; --stage-bottom: #0d0d11; --table-c: #6ea8ff; --culet-c: #f08a4b; --outline-c: #5fbf86;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: var(--ink); text-decoration-color: var(--ruby); text-underline-offset: 3px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 48px; display: grid; gap: 28px; }
header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ink); padding-bottom: 14px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ruby); display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; flex: none; width: 4px; height: 15px; background: var(--gold); clip-path: polygon(0 24%, 100% 0, 100% 76%, 0 100%); }
h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(28px, 4.2vw, 44px); line-height: 1.05; letter-spacing: -.01em; margin: 6px 0 0; text-wrap: balance; }
h2.sec { font-family: var(--font-display); font-weight: 500; font-size: 28px; margin: 0; line-height: 1.1; text-wrap: balance; }
.lede { max-width: 58ch; color: var(--ink-soft); margin: 0; }
.prototype { font-size: 12px; color: var(--muted); border: 1px solid var(--rule); padding: 4px 10px; white-space: nowrap; }
p.copy { margin: 0; color: var(--ink-soft); max-width: 62ch; }

.main { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .main { grid-template-columns: 1fr; } }
.stage { position: relative; aspect-ratio: 4 / 3.4; max-width: 100%; background: radial-gradient(120% 90% at 50% 25%, var(--stage-top), var(--stage-bottom)); clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px)); overflow: hidden; touch-action: none; }
@media (max-width: 900px) { .stage { aspect-ratio: 1 / 1.08; } }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.stage-bar > * { pointer-events: auto; }
.chip { font: 600 13px var(--font-body); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); padding: 7px 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip:focus-visible, .seg button:focus-visible, input:focus-visible, .label-pin:focus-visible { outline: 2px solid var(--ruby); outline-offset: 2px; }
.hint { position: absolute; top: 12px; left: 14px; font-size: 12px; color: var(--ink-soft); pointer-events: none; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.label-pin { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); font: 600 12px var(--font-body); white-space: nowrap; }
.label-pin .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ruby); box-shadow: 0 0 0 3px color-mix(in srgb, var(--paper) 80%, transparent); flex: none; }
.label-pin .txt { background: color-mix(in srgb, var(--paper) 90%, transparent); padding: 2px 6px; border: 1px solid var(--rule); }
.label-pin.active .txt { border-color: var(--ruby); color: var(--ruby); }
.label-pin.left { flex-direction: row-reverse; transform: translate(calc(-100% + 4px), -50%); }
.label-pin.right { transform: translate(-4px, -50%); }

aside.panel { display: grid; gap: 18px; min-width: 0; }
.block { border-top: 2px solid var(--ink); padding-top: 12px; display: grid; gap: 10px; min-width: 0; }
.block h3, .mini { font: 600 12px var(--font-body); letter-spacing: .14em; text-transform: uppercase; margin: 0; color: var(--ink-soft); }
.part-name { font-family: var(--font-display); font-size: 26px; font-weight: 500; margin: 0; line-height: 1.1; }
.part-text { margin: 0; color: var(--ink-soft); max-width: 60ch; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { font: 500 13px var(--font-body); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); padding: 6px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.seg button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--rule); }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.slider label { font-size: 13px; font-weight: 500; }
.slider output { font: 500 13px var(--font-data); font-variant-numeric: tabular-nums; }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--ruby); }
.readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.readout div { background: var(--mist); padding: 8px 10px; min-width: 0; }
.readout dt { font-size: 12px; color: var(--muted); }
.readout dd { margin: 0; font: 500 16px var(--font-data); font-variant-numeric: tabular-nums; }

section.study { border-top: 1px solid var(--ink); padding-top: 18px; display: grid; gap: 16px; }
.two { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
canvas.plot { width: 100%; height: auto; display: block; background: var(--mist); }
#rays { aspect-ratio: 16 / 10; }
#faceup { aspect-ratio: 1 / 1; max-width: 560px; }
.score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.score strong { font: 500 34px var(--font-data); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 3px; display: inline-block; }

table.check { width: 100%; border-collapse: collapse; font-size: 14px; }
table.check th { text-align: left; font: 600 12px var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--ink); }
table.check td { padding: 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.check td.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.pill { display: inline-block; font: 600 12px var(--font-body); padding: 2px 8px; border: 1px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--good); } .pill.mid { color: var(--warn); } .pill.no { color: var(--bad); }
.verdict { border-left: 3px solid var(--ruby); padding: 8px 12px; background: var(--mist); margin: 0; }
.components { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .components { grid-template-columns: 1fr; } }
.components > div { border: 1px solid var(--rule); padding: 10px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.components h4 { margin: 0; font: 600 13px var(--font-body); }
.components ul { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 13px; }
.components .note { font-size: 12px; color: var(--muted); margin: 0; }
.sources { font-size: 13px; color: var(--ink-soft); display: grid; gap: 4px; padding-left: 18px; margin: 0; }
footer.note { font-size: 12px; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; max-width: 95ch; }
.fallback { padding: 24px; color: var(--ink-soft); }
/* jewelloop.net: one column that never grows wider than the screen */
.wrap { grid-template-columns: minmax(0, 1fr); }
.jl-table-scroll { overflow-x: auto; max-width: 100%; }
/* shown once the page's script has run (static/visual/ready.js): no jump while loading */
html:not(.jl-ready) .wrap { visibility: hidden; }

/* On jewelloop.net the page around it shows the title and the introduction. */
header.top { display: none !important; }
