/* Layout: a melting-room card. Choose what you are doing (make a new alloy, change a karat, or mix scrap lots), the
   metal and target standard; the page gives the exact charge for the crucible, draws it, checks the result against the
   standard and its legal tolerance, and explains the arithmetic. */
:root {
  --paper: #ffffff; --ink: #16161a; --ink-soft: #3d3d45; --muted: #6b6b75; --rule: #e4e2de; --mist: #f4f3f1;
  --ruby: #9b1b30; --gold: #b8892f; --good: #2f7d4f; --care: #b7791f;
  --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; --good: #5fbf86; --care: #e3a948; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; margin: 0; }
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: 24px; }
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(30px, 4.6vw, 48px); line-height: 1.03; letter-spacing: -.01em; margin: 6px 0 0; }
h2.sec { font-family: var(--font-display); font-weight: 500; font-size: 28px; margin: 0; line-height: 1.1; }
.lede { max-width: 70ch; color: var(--ink-soft); margin: 6px 0 0; }
.prototype { font-size: 12px; color: var(--muted); border: 1px solid var(--rule); padding: 4px 10px; white-space: nowrap; }
.help { font-size: 12.5px; color: var(--muted); margin: 0; }
section.study { border-top: 1px solid var(--ink); padding-top: 18px; display: grid; gap: 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button, .btn { font: 600 13px var(--font-body); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); padding: 5px 10px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg.big button { font-size: 14px; padding: 8px 14px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--ruby); outline-offset: 2px; }
select, input[type=number] { font: 500 15px var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--ink); padding: 7px 9px; border-radius: 0; width: 100%; }
input[type=number] { font-family: var(--font-data); font-size: 14.5px; }
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; align-content: start; }
.field small { font-weight: 400; color: var(--muted); font-size: 12px; }
.bench { display: grid; gap: 18px; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .bench { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--rule); padding: 14px 16px; display: grid; gap: 14px; }
.step { display: grid; gap: 8px; border-top: 1px solid var(--rule); padding-top: 12px; }
.step:first-child { border-top: 0; padding-top: 0; }
.step > b { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.two { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lots { display: grid; gap: 6px; }
.lot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 6px; align-items: end; }
.lot button { font: 600 16px var(--font-body); border: 1px solid var(--rule); background: transparent; color: var(--muted); width: 36px; height: 37px; cursor: pointer; }
.result { display: grid; gap: 14px; align-content: start; }
.verdict { background: var(--ink); color: var(--paper); padding: 12px 16px; display: grid; gap: 4px; }
.verdict b { font-family: var(--font-display); font-weight: 500; font-size: 26px; line-height: 1.15; }
.verdict span { font-size: 13px; opacity: .8; }
.verdict.err { background: var(--ruby); }
.melt { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
@media (max-width: 620px) { .melt { grid-template-columns: 1fr; } }
.melt svg { width: 100%; height: auto; display: block; }
table.recipe { border-collapse: collapse; width: 100%; font-size: 14px; }
.recipe td, .recipe th { padding: 7px 6px; border-bottom: 1px solid var(--rule); text-align: left; }
.recipe th { font-weight: 600; font-size: 12px; color: var(--muted); }
.recipe td.n { font-family: var(--font-data); text-align: right; white-space: nowrap; }
.recipe tr.tot td { border-top: 1.5px solid var(--ink); font-weight: 600; }
.sw { display: inline-block; width: 11px; height: 11px; margin-right: 8px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.25); }
.checks { display: grid; gap: 6px; }
.chk { font-size: 13.5px; padding: 8px 10px; background: var(--mist); border-left: 3px solid var(--good); }
.chk.warn { border-left-color: var(--care); }
.chk.bad { border-left-color: var(--ruby); }
.tables { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ref { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.ref th, .ref td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ref th { border-bottom: 1px solid var(--ink); font-weight: 600; }
.ref td.n { font-family: var(--font-data); font-size: 12.5px; }
.ref caption { text-align: left; font-family: var(--font-display); font-size: 20px; padding-bottom: 6px; }
.how { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.how div { border-top: 2px solid var(--gold); padding-top: 8px; font-size: 14px; color: var(--ink-soft); }
.how h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; margin: 0 0 4px; color: var(--ink); }
.how code { font-family: var(--font-data); font-size: 12.5px; background: var(--mist); padding: 1px 5px; display: inline-block; margin: 2px 0; }
.sources { display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); max-width: 92ch; }
.sources p { margin: 0; }
.svg-lab { font: 600 11.5px var(--font-body); fill: var(--ink); }
.svg-sub { font: 500 10.5px var(--font-data); fill: var(--muted); }
.svg-line { stroke: var(--muted); stroke-width: 1; fill: none; }
.tolbox { border: 1px solid var(--rule); padding: 8px 10px; }
.tolbox svg { width: 100%; height: auto; display: block; }
/* 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; }
