/* Atomurus — isomer explorer (assets/chem/iso-explorer.js).
   Loads after assets/remake/remake.css, which holds the base `iso-x-` skin;
   this file adds names, functional-group highlights, touch targets, the
   "copy link" button and motion. Every animation/transition is switched off
   under prefers-reduced-motion and html[data-reduced-motion="1"]. */

/* ── form row, copy link, inline errors ─────────────────────────── */
html[data-rm] body.rm.rm .iso-x-row { align-items: stretch; }
html[data-rm] body.rm.rm .iso-x-row input { flex: 1 1 220px; }
html[data-rm] body.rm.rm .iso-x-row button { flex: 0 1 auto; min-height: 48px; transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
html[data-rm] body.rm.rm .iso-x-row .iso-x-copy { background: transparent; border: 1px solid var(--rm-line-strong); color: var(--rm-ink); }
html[data-rm] body.rm.rm .iso-x-row .iso-x-copy:hover { border-color: var(--rm-green); color: var(--rm-green); }
html[data-rm] body.rm.rm .iso-x-row .iso-x-copy.is-done { background: var(--rm-green-soft); border-color: var(--rm-green); color: var(--rm-green); }
html[data-rm] body.rm.rm .iso-x-row .iso-x-copy.is-fail { border-color: var(--rm-amber); color: var(--rm-amber); }
html[data-rm] body.rm.rm .iso-x-row input[aria-invalid="true"] { border-color: var(--rm-amber); }
html[data-rm] body.rm.rm .iso-x-error { animation: iso-x-fade .18s ease-out both; }
html[data-rm] body.rm.rm .iso-x-error[hidden] { display: none; }
html[data-rm] body.rm.rm .iso-x-tabs button,
html[data-rm] body.rm.rm .iso-x-chips button,
html[data-rm] body.rm.rm .iso-x-filter button,
html[data-rm] body.rm.rm .iso-x-3d-bar button { min-height: 44px; transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
html[data-rm] body.rm.rm .iso-x-chips button,
html[data-rm] body.rm.rm .iso-x-filter button { padding: 0 14px; }
html[data-rm] body.rm.rm .iso-x-tabs button:focus-visible,
html[data-rm] body.rm.rm .iso-x-chips button:focus-visible,
html[data-rm] body.rm.rm .iso-x-filter button:focus-visible,
html[data-rm] body.rm.rm .iso-x-row button:focus-visible,
html[data-rm] body.rm.rm .iso-x-go:focus-visible,
html[data-rm] body.rm.rm .iso-x-3d-bar button:focus-visible { outline: 2px solid var(--rm-green); outline-offset: 2px; }

/* ── cards: names, entrance, selection ───────────────────────────── */
html[data-rm] body.rm.rm .iso-x-card { position: relative; min-height: 44px; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; animation: iso-x-in .22s ease-out both; animation-delay: calc(var(--i, 0) * 16ms); }
html[data-rm] body.rm.rm .iso-x-card:hover { transform: translateY(-1px); }
html[data-rm] body.rm.rm .iso-x-card:focus-visible { outline: 2px solid var(--rm-green); outline-offset: 2px; }
html[data-rm] body.rm.rm .iso-x-card.is-picked { animation: iso-x-pick .32s ease-out both; }
html[data-rm] body.rm.rm .iso-x-card.is-picked::after { content: attr(data-order); position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--rm-green); color: var(--rm-on-green); font: 700 12px/1 var(--rm-font); }
html[data-rm] body.rm.rm .iso-x-name { margin: 2px 0 0; font: 700 15px/1.3 var(--rm-font); color: var(--rm-ink); letter-spacing: -0.01em; overflow-wrap: anywhere; }
html[data-rm] body.rm.rm .iso-x-cond { font-size: 12.5px; color: var(--rm-ink-2); }
html[data-rm] body.rm.rm .iso-x-go { min-height: 44px; padding: 10px 0 0; }
html[data-rm] body.rm.rm .iso-x-legend { margin: 12px 0 0; }

/* ── compare panel ───────────────────────────────────────────────── */
html[data-rm] body.rm.rm .iso-x-compare { transition: background-color .25s ease, box-shadow .25s ease; }
html[data-rm] body.rm.rm .iso-x-compare.is-ready { background: var(--rm-green-soft); box-shadow: inset 0 0 0 1px var(--rm-green); }
html[data-rm] body.rm.rm .iso-x-verdict { animation: iso-x-fade .25s ease-out both; }
html[data-rm] body.rm.rm .iso-x-pair { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; overflow-wrap: anywhere; }
html[data-rm] body.rm.rm .iso-x-pair b { color: var(--rm-ink-3); font-weight: 600; }
html[data-rm] body.rm.rm .iso-x-type { overflow-wrap: anywhere; }

/* ── one-molecule panel ──────────────────────────────────────────── */
html[data-rm] body.rm.rm .iso-x-one { animation: iso-x-fade .25s ease-out both; }
html[data-rm] body.rm.rm .iso-x-one-name { margin: 0 0 10px; font: 700 20px/1.25 var(--rm-font); color: var(--rm-ink); letter-spacing: -0.01em; overflow-wrap: anywhere; }
html[data-rm] body.rm.rm .iso-x-stage { position: relative; }
html[data-rm] body.rm.rm .iso-x-3d.is-off .iso-x-stage { display: none; }

/* ── drawing: heteroatom bonds, functional group, chiral carbon ──── */
html[data-rm] body.rm.rm .iso-x-svg line { transition: stroke .2s ease; }
html[data-rm] body.rm.rm .iso-x-svg line.is-het.el-O { stroke: #C2412F; }
html[data-rm] body.rm.rm .iso-x-svg line.is-het.el-N { stroke: #3159B8; }
html[data-rm] body.rm.rm .iso-x-svg line.is-het.el-Cl, html[data-rm] body.rm.rm .iso-x-svg line.is-het.el-F { stroke: #2F8A43; }
html[data-rm] body.rm.rm .iso-x-svg line.is-het.el-Br { stroke: #8B3A2C; }
html[data-rm] body.rm.rm .iso-x-svg line.is-het.el-I { stroke: #6B3A8F; }
html[data-rm] body.rm.rm .iso-x-svg line.is-fg { stroke-width: 2.4; }
html[data-rm] body.rm.rm .iso-x-svg line.is-fg.el-C { stroke: var(--rm-green); }
html[data-rm] body.rm.rm .iso-x-svg .el-I { fill: #6B3A8F; }
html[data-rm] body.rm.rm .iso-x-svg .iso-x-halo { fill: var(--rm-green-soft); }
html[data-rm] body.rm.rm .iso-x-svg .iso-x-chiral-ring { fill: none; stroke: var(--rm-green); stroke-width: 1.2; stroke-dasharray: 3 2.5; }
html[data-rm] body.rm.rm .iso-x-svg text.is-fg.el-C { fill: var(--rm-ink); }
html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg line.is-het.el-O { stroke: #EF7A6A; }
html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg line.is-het.el-N { stroke: #86A8F2; }
html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg line.is-het.el-Cl, html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg line.is-het.el-F { stroke: #5FC27A; }
html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg .el-Cl, html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg .el-F { fill: #5FC27A; }
html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg line.is-het.el-Br, html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg .el-Br { stroke: #D98A78; fill: #D98A78; }
html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg line.is-het.el-I, html[data-rm][data-theme="dark"] body.rm.rm .iso-x-svg .el-I { stroke: #C49BE0; fill: #C49BE0; }

/* ── keyframes ───────────────────────────────────────────────────── */
@keyframes iso-x-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes iso-x-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes iso-x-pick { from { box-shadow: 0 0 0 0 rgba(30, 106, 80, .45); } to { box-shadow: 0 0 0 3px rgba(30, 106, 80, .16); } }

/* ── small screens ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  html[data-rm] body.rm.rm .iso-x { padding: 16px 14px !important; border-radius: 14px !important; }
  html[data-rm] body.rm.rm .iso-x-title { font-size: 24px !important; }
  html[data-rm] body.rm.rm .iso-x-tabs { display: flex; }
  html[data-rm] body.rm.rm .iso-x-tabs button { flex: 1 1 auto; padding: 0 10px; }
  html[data-rm] body.rm.rm .iso-x-row input { flex-basis: 100%; }
  html[data-rm] body.rm.rm .iso-x-row button { flex: 1 1 auto; padding: 0 12px; }
  html[data-rm] body.rm.rm .iso-x-grid { grid-template-columns: 1fr; }
  html[data-rm] body.rm.rm .iso-x-compare { top: calc(var(--rm-header-h) + 4px); padding: 10px 12px; }
  html[data-rm] body.rm.rm .iso-x-3d canvas { height: 260px; }
}

/* ── reduced motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html[data-rm] body.rm.rm .iso-x *, html[data-rm] body.rm.rm .iso-x *::before, html[data-rm] body.rm.rm .iso-x *::after { animation: none !important; transition: none !important; }
  html[data-rm] body.rm.rm .iso-x-card:hover { transform: none; }
}
html[data-rm][data-reduced-motion="1"] body.rm.rm .iso-x *, html[data-rm][data-reduced-motion="1"] body.rm.rm .iso-x *::before, html[data-rm][data-reduced-motion="1"] body.rm.rm .iso-x *::after { animation: none !important; transition: none !important; }
html[data-rm][data-reduced-motion="1"] body.rm.rm .iso-x-card:hover { transform: none; }
