/* Digital-twin studio: scenario comparison (A fixed, B live), "what changed and why" and the canopy cross-section,
   all inside the parameters drawer (.tw-params, a dark application window). Motion uses the site tokens
   (--dur-*, --ease-*); nothing moves under reduced motion. */

.tw-res-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.tw-sim { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.tw-res-h .tw-sim { margin-left: 0; }
.tw-sim::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* A/B bar */
.tw-cmp-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 4px 0 20px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.025); transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out); }
.tw-cmp-bar.is-on { border-color: rgba(216, 243, 106, 0.38); background: rgba(216, 243, 106, 0.045); }
.tw-cmp-txt { min-width: 0; flex: 1 1 280px; }
.tw-cmp-h { margin: 0 0 3px; font-weight: 750; font-size: 0.94rem; color: var(--fg); }
.tw-cmp-s { margin: 0; font-size: 0.8rem; line-height: 1.45; color: var(--fg-2); }
.tw-cmp-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.tw-btn.is-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tw-btn.is-primary:hover { color: var(--accent-ink); border-color: var(--accent); filter: brightness(1.06); }
.tw-btn.is-compare { color: var(--fg); border-color: rgba(66, 211, 156, 0.55); background: rgba(66, 211, 156, 0.08); }
.tw-cmp-btns .tw-btn:focus-visible, .tw-sec .mini:focus-visible, .tw-sec-table summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A/B table (the site's generic th style is uppercase and sticky; these cells are labels and numbers) */
.tw-cmp-table { overflow-x: auto; }
.tw-cmp-table[hidden] { display: none; }
.tw-cmp-t { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tw-cmp-t caption { caption-side: top; text-align: left; padding: 0 0 8px; font-size: 0.72rem; color: var(--fg-3); }
.tw-cmp-t th, .tw-cmp-t td { position: static; padding: 7px 6px; text-align: left; vertical-align: baseline; border-bottom: 1px solid var(--line); background: none; font-size: inherit; letter-spacing: normal; text-transform: none; }
.tw-cmp-t thead th { padding-top: 0; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); border-bottom-color: var(--line-2); }
.tw-cmp-t .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tw-cmp-t tbody th { font-weight: 500; line-height: 1.3; color: var(--fg-2); }
.tw-cmp-t tbody th small { display: block; margin-top: 1px; font-size: 0.68rem; color: var(--fg-3); }
.tw-cmp-t tr.g th { padding-top: 14px; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand-mint); border-bottom-color: var(--line-2); }
.tw-cmp-t td.is-b { font-weight: 700; color: var(--fg); }
.tw-cmp-t td.d { color: var(--fg-3); }
.tw-cmp-t tr.is-diff td.d { font-weight: 700; color: var(--accent); }
.tw-cmp-t td.d small { display: block; font-size: 0.7rem; font-weight: 600; color: var(--fg-2); }
.tw-cmp-t tr.is-diff th span { color: var(--fg); }
.tw-cmp-t tbody tr:last-child > * { border-bottom: 1px solid var(--line); }

/* what changed and why */
.tw-why { margin: 22px 0 0; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.16); transition: opacity var(--dur-2) var(--ease-out); }
.tw-why[hidden] { display: none; }
.tw-why.is-busy { opacity: 0.62; }
.tw-why-h { margin: 0; font-size: 1rem; font-weight: 700; color: var(--fg); }
.tw-why > .tw-sub { margin: 12px 0 8px; }
.tw-why-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.tw-why-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 14px; margin: 0 0 6px; font-size: 0.84rem; color: var(--fg-2); }
.tw-why-in b { color: var(--fg); font-variant-numeric: tabular-nums; }
.tw-why-r { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.87rem; line-height: 1.5; color: var(--fg); }
.tw-why-r li::marker { color: var(--brand-mint); }
.tw-why-note { margin: 14px 0 0; font-size: 0.8rem; line-height: 1.45; color: var(--fg-2); }
.tw-why-wait { margin: 0; font-size: 0.8rem; color: var(--fg-3); }

/* canopy cross-section */
.tw-sec { margin: 22px 0 0; padding: 14px 16px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.16); }
.tw-sec-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.tw-sec-cap { min-width: 0; flex: 1 1 260px; margin: 0; }
.tw-sec-t { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; font-size: 0.94rem; font-weight: 750; color: var(--fg); }
.tw-sec-w { display: block; margin-top: 3px; font-size: 0.78rem; line-height: 1.4; color: var(--fg-2); }
.tw-sec-mode { display: flex; flex-wrap: wrap; gap: 6px; }
.tw-sec-plot { width: 100%; min-width: 0; }
.tw-sec-svg { display: block; width: 100%; height: auto; }
.tw-sec-svg .s-crop { fill: rgba(66, 211, 156, 0.075); }
.tw-sec-svg .s-grid { stroke: var(--line); stroke-width: 1; }
.tw-sec-svg .s-base { stroke: var(--line-2); stroke-width: 1; }
.tw-sec-svg .s-tick { stroke: var(--fg-3); stroke-width: 1; }
.tw-sec-svg .s-ax { fill: var(--fg-3); font-family: var(--font); font-size: 11px; font-variant-numeric: tabular-nums; }
.tw-sec-svg .s-title { fill: var(--fg-2); font-family: var(--font); font-size: 11px; font-weight: 600; }
.tw-sec-svg .s-lum { fill: var(--brand-mint); }
.tw-sec-svg .s-lum-a { fill: #c9d3cf; fill-opacity: 0.75; }
.tw-sec-svg .s-guide { stroke: var(--brand-mint); stroke-opacity: 0.24; stroke-dasharray: 2 3; }
.tw-sec-svg .s-line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.tw-sec-svg .s-b { stroke: var(--brand-mint); stroke-width: 2.2; }
.tw-sec-svg .s-a { stroke: #c9d3cf; stroke-width: 1.6; stroke-dasharray: 6 4; }
.tw-sec-svg .s-avg { stroke: var(--brand-mint); stroke-opacity: 0.65; stroke-dasharray: 5 4; }
.tw-sec-svg .s-min { stroke: var(--brand-mint); stroke-opacity: 0.65; stroke-dasharray: 1.5 3; }
.tw-sec-svg .s-avg.is-a, .tw-sec-svg .s-min.is-a { stroke: #c9d3cf; }
.tw-sec-svg .s-thr { stroke: var(--accent); stroke-dasharray: 2 3; }
.tw-sec-svg .s-lbl { fill: var(--brand-mint); stroke: none; font-family: var(--font); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.tw-sec-svg .s-lbl.is-a { fill: #c9d3cf; }
.tw-sec-svg .s-lbl.is-thr { fill: var(--accent); }
.tw-sec-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; color: var(--fg-2); }
.tw-sec-legend .k::before { content: ''; display: inline-block; width: 16px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--brand-mint); }
.tw-sec-legend .k-a::before { border-top: 2px dashed #c9d3cf; }
.tw-sec-legend .k-lum::before { width: 10px; height: 5px; border: 0; border-radius: 1px; background: var(--brand-mint); }
.tw-sec-legend .k-luma::before { width: 10px; height: 5px; border: 0; border-radius: 1px; background: rgba(201, 211, 207, 0.75); }
.tw-sec-legend .k-crop::before { width: 12px; height: 10px; border: 0; background: rgba(66, 211, 156, 0.2); }
.tw-sec-legend .k-avg::before { border-top: 2px dashed rgba(66, 211, 156, 0.7); }
.tw-sec-legend .k-min::before { border-top: 2px dotted rgba(66, 211, 156, 0.75); }
.tw-sec-legend .k-thr::before { border-top: 2px dotted var(--accent); }
.tw-sec-sum { margin: 10px 0 0; font-size: 0.84rem; line-height: 1.45; color: var(--fg); }
.tw-sec-table { margin-top: 8px; }
.tw-params .tw-sec-table summary { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; list-style: none; font-size: 0.8rem; font-weight: 700; color: var(--brand-mint); }
.tw-params .tw-sec-table summary::-webkit-details-marker { display: none; }
.tw-params .tw-sec-table summary::after { content: '+'; font-size: 1rem; font-weight: 400; }
.tw-params .tw-sec-table[open] summary::after { content: '–'; }
.tw-sec-tw { max-height: 320px; margin-top: 6px; overflow: auto; }
.tw-sec-tbl { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.tw-sec-tbl th, .tw-sec-tbl td { position: static; padding: 4px 8px; text-align: left; vertical-align: baseline; border-bottom: 1px solid var(--line); background: none; font-size: inherit; letter-spacing: normal; text-transform: none; }
.tw-sec-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tw-sec-tbl tbody th { font-weight: 500; color: var(--fg-2); }
.tw-sec-tbl thead th { position: sticky; top: 0; background: var(--ink-1); font-size: 0.7rem; font-weight: 700; color: var(--fg-3); }

@media (max-width: 760px) {
  .tw-cmp-bar { padding: 12px; margin-bottom: 16px; }
  .tw-cmp-t { font-size: 0.76rem; }
  .tw-cmp-t th, .tw-cmp-t td { padding: 6px 4px; }
  .tw-why, .tw-sec { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tw-cmp-bar, .tw-why { transition: none; }
}
