/* ================= General cheat sheets (js/gsheets.js) + NMR Library (js/nmrlib.js) ================= */
/* pre-drawn RDKit structures: a span sized in em (so they shrink with the sheet's font), the SVG fills it */
.st { display: inline-block; max-width: 100%; line-height: 0; vertical-align: middle; }
.st svg { width: 100%; height: auto; display: block; overflow: visible; }

/* Common Molecules: two tiles per column */
.gs-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .35em .5em; }
.gs-tile { margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center; break-inside: avoid; min-width: 0; }
.gs-draw { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 3.2em; width: 100%; }
.gs-tile figcaption { line-height: 1.15; }
.gs-tile figcaption b { font-size: 1.05em; }
.gs-tile figcaption small { display: block; font-size: .78em; color: var(--ink2); font-weight: 700; }
.gs-note { display: block; font-size: .8em; color: var(--ink2); }
.gs-tag { font-size: .7em; font-weight: 900; padding: 0 .3em; border-radius: 3px; vertical-align: .1em; border: 1px solid currentColor; }
.gs-tag.pa { color: #1c7ed6; } .gs-tag.pp { color: #e8590c; } .gs-tag.np { color: #5c940d; }
.gs-molecules .sh-box h3 { margin-bottom: .2em; }
.gs-molecules .sh-note { margin: 0 0 .3em; }

/* NMR sheet: shift charts + splitting sticks */
.gs-chart { width: 100%; height: auto; display: block; margin: .1em 0 .2em; }
.gs-grid { stroke: var(--line); stroke-width: .5; }
.gs-wide { column-span: all; }
.gs-charts { display: grid; grid-template-columns: 440fr 290fr; gap: .25in; align-items: start; }
.gs-ax { font-size: 7.5px; fill: var(--ink2); text-anchor: middle; font-weight: 700; }
.gs-lbl { font-size: 8.5px; fill: var(--ink); font-weight: 700; }
.gs-bar { fill: color-mix(in srgb, var(--c) 55%, white); }
.gs-bar.var { fill: none; stroke: var(--c); stroke-dasharray: 2 1.5; }
.gs-sticks { width: 3.4em; height: 1.25em; display: block; }
.gs-sticks line { stroke: var(--c); stroke-width: 1.6; }
.gs-split td { vertical-align: middle; }
.gs-split td:nth-child(2) { text-align: center; }
.gs-pat td:first-child { font-weight: 800; }
.gsheet ol { margin: 0 0 .2em; padding-left: 1.3em; }
.gsheet ol li { margin: .08em 0; break-inside: avoid; }

/* Functional groups */
.gs-fg figcaption { text-align: left; width: 100%; }
.gs-fg figcaption b { display: block; text-align: center; }
.gs-name { display: block; text-align: center; font-weight: 800; color: color-mix(in srgb, var(--c) 60%, var(--ink)); font-size: .88em; }
.gs-fg .gs-note { font-size: .76em; line-height: 1.2; }
.gs-prio { columns: 2; column-gap: 1.4em; }
.gs-chain { display: flex; flex-wrap: wrap; gap: .15em .7em; margin: 0; }
.gs-chain span { white-space: nowrap; }
/* Reagents */
.gs-grid-t td, .gs-grid-t th { text-align: center; font-size: .92em; }
.gs-grid-t td:first-child, .gs-grid-t th:first-child { text-align: left; }
.gs-rg td:first-child { width: 42%; }
/* pKa ladder */
.gs-ladder td { vertical-align: middle; }
.gs-pk { font-weight: 900; text-align: right; white-space: nowrap; color: color-mix(in srgb, var(--c) 60%, var(--ink)); }
.gs-lad { display: inline-block; vertical-align: middle; margin-right: .35em; }
.gs-acid { font-weight: 700; }
.gs-pka .sh-cols { column-count: 2; }
.gs-keep { break-inside: avoid; }
.gs-rgrids { grid-template-columns: 1.45fr 1fr; }
/* IR & MS */
.gs-ir { margin: 0 0 .3em; --brand: var(--c); break-inside: avoid; }
.gs-ir svg { width: 100%; height: auto; display: block; }
.gs-isos { display: grid; grid-template-columns: 1fr; gap: .2em; }
.gs-iso { margin: 0; display: flex; align-items: center; gap: .4em; break-inside: avoid; }
.gs-iso svg { width: 5.2em; flex: none; }
.gs-iso line { stroke: var(--c); stroke-width: 3; }
.gs-iso text { font-size: 7.5px; fill: var(--ink2); text-anchor: middle; font-weight: 700; }
.gs-iso figcaption { font-size: .85em; line-height: 1.2; }

/* ================= NMR Library ================= */
.nl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 14px 0; }
.nl-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border: 2px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); text-decoration: none; text-align: center; transition: transform .15s, border-color .15s; }
.nl-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.nl-card .nl-mini { background: #fff; border-radius: 10px; padding: 6px; width: 100%; display: flex; justify-content: center; min-height: 74px; align-items: center; }
.nl-card small { color: var(--ink2); font-weight: 700; }
.nl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nl-head .spacer { flex: 1; }
.nl-top { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 16px; align-items: start; margin: 12px 0; }
.nl-top .nl-table { margin-top: 0; }
.nl-mol { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #222; }
.nl-mol .st { width: 100%; max-width: 260px; }
.nl-mol .nl-formula { font-weight: 900; font-size: 15px; }
.nl-mol .nl-dou { font-size: 13px; color: #555; font-weight: 700; }
.nl-hidden { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 160px; text-align: center; font-weight: 800; color: #555; }
.nl-spec { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 8px 6px 4px; color: #222; overflow: hidden; }
.nl-spec h4 { margin: 2px 8px 0; font-size: 14px; color: #333; }
.nl-spec svg { width: 100%; height: auto; display: block; }
.nl-spec .ax { stroke: #333; stroke-width: 1; }
.nl-spec .tk { font-size: 11px; fill: #444; text-anchor: middle; font-family: var(--font); font-weight: 700; }
.nl-spec .trace { fill: none; stroke: #222; stroke-width: 1.1; stroke-linejoin: round; }
.nl-spec .integ { fill: none; stroke: #999; stroke-width: 1; }
.nl-spec .inset rect { fill: #fff; stroke: #ccc; }
.nl-spec .lead { stroke: #bbb; stroke-dasharray: 2 2; }
.nl-spec .il { font-size: 11px; font-weight: 800; text-anchor: middle; font-family: var(--font); }
.nl-spec .il2 { font-size: 10px; fill: #555; text-anchor: middle; font-family: var(--font); font-weight: 700; }
.nl-spec .solv { stroke: #aaa; }
.nl-spec .solvl { font-size: 10px; fill: #999; text-anchor: middle; font-family: var(--font); }
.nl-spec g.sig { cursor: pointer; }
.nl-spec g.sig.dim { opacity: .25; }
.nl-table { width: 100%; border-collapse: collapse; margin: 10px 0 4px; font-size: 14.5px; }
.nl-table th, .nl-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.nl-table th { font-size: 13px; color: var(--ink2); }
.nl-table tr.sig { cursor: pointer; }
.nl-table tr.sig.on { background: var(--soft); }
.nl-letter { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-weight: 900; }
.nl-why { color: var(--ink2); font-size: 13.5px; margin-top: 2px; }
.nl-lesson { font-weight: 800; color: var(--ink2); margin: 2px 0 0; }
.nl-note { font-size: 13px; }
@media (max-width: 700px) {
  .nl-top { grid-template-columns: 1fr; }
  /* spectra keep a readable size on phones and scroll sideways */
  .nl-spec { overflow-x: auto; }
  .nl-spec svg { width: 640px; max-width: none; }
  .nl-table td small { white-space: nowrap; }
  .nl-table { font-size: 13.5px; }
  .nl-table td, .nl-table th { padding: 6px 4px; }
}
