/* Thermochemistry Lab (beta). Uses the site tokens from /assets/css/site.css. */
.tc-bar { margin: 0 0 0.4rem; }
.tc-bar-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.6rem 1.2rem; padding: 0.8rem 1.2rem; }
.tc-source { margin: 0; font-size: 0.86rem; color: var(--text-2); max-width: 46rem; }
.tc-unit-field { margin: 0; min-width: 10rem; }

.tc-tabs { display: flex; gap: 0.25rem; margin: 1.2rem 0 1.2rem; box-shadow: inset 0 -1px 0 var(--border-strong); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tc-tabs [role="tab"] { flex: 0 0 auto; background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.6rem 0.95rem 0.55rem; font: inherit; font-size: 0.95rem; font-weight: 600; color: var(--text-2); cursor: pointer; }
.tc-tabs [role="tab"]:hover { color: var(--accent); }
.tc-tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tc-tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tc-panel > * + * { margin-top: 1.2rem; }

.tc-mono, .tc-num, .tc-formula-code { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tc-combo { position: relative; }
.tc-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% - 1.6rem); margin: 0; padding: 0.25rem 0; list-style: none; max-height: 22rem; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.tc-list li { display: grid; grid-template-columns: minmax(6rem, auto) 1fr auto; gap: 0.75rem; align-items: baseline; padding: 0.4rem 0.75rem; cursor: pointer; font-size: 0.9rem; }
.tc-list li[aria-selected="true"], .tc-list li:hover { background: var(--accent-soft); }
.tc-list .tc-l-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-list .tc-l-h { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.tc-state { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

.tc-examples { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tc-examples button { font: inherit; font-size: 0.82rem; font-family: var(--mono); padding: 0.25rem 0.6rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.tc-examples button:hover { border-color: var(--accent); color: var(--accent); }

.tc-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.9rem; }
.tc-res { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem; background: var(--surface); }
.tc-res h3 { margin: 0 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.tc-res h3 sub, .panel-head h2 sub, .tc-st-group sub { text-transform: none; }
.tc-res .tc-big { font-family: var(--mono); font-size: 1.35rem; color: var(--text); font-variant-numeric: tabular-nums; }
.tc-res .tc-alt { font-family: var(--mono); font-size: 0.8rem; color: var(--text-2); margin-top: 0.3rem; line-height: 1.55; }
.tc-res .tc-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.45; }

.tc-table-scroll { overflow-x: auto; }
.tc-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.tc-table th, .tc-table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tc-table thead th { background: var(--surface-2); color: var(--text); font-weight: 600; white-space: nowrap; font-size: 0.8rem; }
.tc-table .num { text-align: right; font-family: var(--mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tc-table tr.tc-closed td { color: var(--muted); }
.tc-table select { max-width: 16rem; font-size: 0.82rem; }
.tc-table a.tc-go { font-size: 0.8rem; white-space: nowrap; }

.tc-msg { padding: 0.7rem 1rem; border-radius: var(--radius-sm); font-size: 0.9rem; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.tc-msg.tc-bad { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.tc-msg.tc-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

.tc-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.9rem; }
.tc-card-head h2 { font-size: 1.35rem; margin: 0; text-transform: none; letter-spacing: 0; color: var(--text); }
.tc-card-head .tc-formula { font-size: 1.2rem; }
.tc-ids { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; font-size: 0.86rem; margin: 0.8rem 0 0; }
.tc-ids dt { color: var(--muted); }
.tc-ids dd { margin: 0; font-family: var(--mono); font-size: 0.82rem; overflow-wrap: anywhere; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.field.tc-checks > label { display: flex; justify-content: flex-start; gap: 0.45rem; align-items: center; font-size: 0.88rem; color: var(--text-2); margin: 0.15rem 0; font-weight: 400; }
.tc-share { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.8rem; }
.tc-share .hint { margin: 0; }

.tc-st-table tbody th { font-weight: 500; min-width: 13rem; }
.tc-st-group th { background: var(--bg-soft); color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 650; }
.tc-st-summary { font-weight: 600; color: var(--text); }
.tc-prose { margin-top: 2.4rem; }
.tc-terms { margin-top: 2rem; }
.tc-tag { display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 0.45rem; margin-top: 0.2rem; white-space: normal; }

.tc-data p:first-child { margin-top: 0; }

/* uncertainty, flags, excited-product rows */
.tc-ucor { font-size: 0.68rem; color: var(--accent); margin-left: 0.1rem; }
.tc-flag { display: inline-block; font: inherit; font-size: 0.68rem; font-weight: 600; line-height: 1.4; color: var(--warn); border: 1px solid var(--warn-border); background: var(--warn-soft); border-radius: 999px; padding: 0 0.35rem; cursor: pointer; }
.tc-flag:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tc-flag[aria-expanded="true"] { background: var(--warn-border); }
.tc-flagtext { display: block; margin-top: 0.2rem; font-size: 0.78rem; color: var(--text-2); white-space: normal; max-width: 36rem; }
.tc-utable { border-collapse: collapse; font-size: 0.8rem; margin-top: 0.5rem; }
.tc-utable th { text-align: left; font-weight: 500; color: var(--text-2); padding: 0.1rem 0.8rem 0.1rem 0; }
.tc-utable td { font-family: var(--mono); text-align: right; padding: 0.1rem 0; white-space: nowrap; }
.tc-table tr.tc-exrow > td { background: var(--bg-soft); padding: 0.3rem 0.6rem 0.5rem 1.4rem; }
.tc-exrow summary { cursor: pointer; font-size: 0.82rem; color: var(--text-2); padding: 0.2rem 0; }
.tc-exrow summary:hover { color: var(--accent); }
.tc-extable { margin-top: 0.3rem; background: var(--surface); }
.tc-extable th, .tc-extable td { padding: 0.3rem 0.5rem; }
.field.tc-checks > label.tc-sub { padding-left: 1.4rem; font-size: 0.84rem; }
.tc-ver { margin-top: 1rem; }
.tc-ver h3 { margin: 0 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.tc-ver-table { max-width: 32rem; }
.tc-ver-table tbody th { font-weight: 500; }
.tc-exrefs { font-size: 0.82rem; }

/* energy diagram */
.tc-lvls { display: grid; gap: 0.4rem; }
.tc-lvl { display: grid; grid-template-columns: minmax(7rem, 1.4fr) minmax(5rem, 1fr) minmax(6rem, 0.9fr) minmax(8rem, 1.1fr) auto; gap: 0.4rem; align-items: center; }
.tc-lvl .input { min-width: 0; }
#dg-p { width: 100%; resize: vertical; min-height: 5.5rem; }
.tc-dg-wrap { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); min-height: 2rem; }
.tc-dg-wrap svg { display: block; max-width: none; }
.tc-dg-table { margin-top: 1rem; }

@media (max-width: 640px) {
    .tc-tabs [role="tab"] { padding: 0.55rem 0.7rem 0.5rem; font-size: 0.9rem; }
    .tc-list li { grid-template-columns: auto 1fr; }
    .tc-list .tc-l-h { display: none; }
    .tc-ids { grid-template-columns: 1fr; }
    .tc-ids dd { margin-bottom: 0.3rem; }
    .tc-lvl { grid-template-columns: 1fr 1fr; }
    .tc-lvl button { justify-self: start; }
    .tc-table tr.tc-exrow > td { padding-left: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) { .tc-panel * { transition: none !important; animation: none !important; } }
