/* Subsidy Simulator (economics/export-subsidy.php). Builds on the Tariff and Quota pages' stylesheet
   (economics/trade-policy.css: the stage, the diagram's classes and colours, the tables); this adds the
   subsidised supply curve, the government's hatched cost, the comparison view and the groups list.
   Theme tokens only (the page's names for some below). */

/* this page's colours, pointing at the theme (css/theme.css) */
:root{
  --curve-s1:var(--viz-2);        /* supply + subsidy, and the price firms get */
  --gov-hatch:var(--curve-price); /* the government's cost */
  --pay-cons:var(--viz-5);        /* who pays: consumers */
  --pay-tax:var(--viz-1);         /* who pays: taxpayers */
}

/* ---------- the diagram ---------- */
.tp-svg .sb-curve-s1{stroke:var(--curve-s1);stroke-width:3;stroke-dasharray:9 4}
.tp-svg .sb-price-get{stroke:var(--curve-s1);stroke-width:1.6;stroke-dasharray:2 4}
.tp-svg .sb-gov{stroke:var(--gov-hatch);stroke-width:2;stroke-dasharray:6 3}
.tp-svg .sb-hatch-line{stroke:var(--gov-hatch);stroke-width:1.4;opacity:.6}
.tp-svg .sb-lbl-s1{fill:var(--curve-s1)}
.tp-svg .sb-trade{stroke:var(--ink-soft);stroke-width:1.6}
.tp-svg .sb-arrow-head{fill:var(--ink-soft)}
.tp-svg .sb-trade-text{font-size:calc(12.5px * var(--k));font-weight:600;fill:var(--ink)}
.tp-svg .sb-rent{fill:var(--viz-4-area);stroke:var(--curve-q)}
.sb-sw-gov{background:repeating-linear-gradient(45deg,var(--gov-hatch) 0 2px,transparent 2px 6px);border:1.5px dashed var(--gov-hatch)}

/* ---------- the side panel ---------- */
.sb-presets-row{display:flex;flex-direction:column;gap:4px}
.sb-presets{display:flex;flex-wrap:wrap;gap:6px}
.sb-presets .btn{min-height:32px}
.sb-story{margin:0;line-height:1.4}
.sb-type{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.sb-type .lab{font:600 13px/1.2 var(--font-display);color:var(--ink)}
.sb-price{margin:0;line-height:1.4;color:var(--ink-soft)}
.sb-price b{color:var(--ink)}
.sb-single{display:flex;flex-direction:column;gap:8px}
body.sb-is-compare .sb-single{display:none}
.sb-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
.sb-groups{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:5px}
.sb-g{display:flex;flex-direction:column;gap:1px;padding:5px 9px;border-left:3px solid var(--line-strong);background:var(--panel-2);border-radius:0 5px 5px 0;font-size:13px;line-height:1.4;color:var(--ink-soft)}
.sb-g b{font:600 13px/1.3 var(--font-display);color:var(--ink)}
.sb-g.up{border-left-color:var(--ok)}
.sb-g.down{border-left-color:var(--bad)}

/* ---------- compare ---------- */
.sb-compare{display:flex;flex-direction:column;gap:6px;padding:10px 12px;min-width:0;min-height:0;overflow:auto}
.sb-minis{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;flex:1;min-height:150px}
.sb-minis figure{margin:0;display:flex;flex-direction:column;min-height:0;min-width:0}
.sb-minis figcaption{font:700 13px/1.2 var(--font-display);color:var(--ink);text-align:center;margin-bottom:2px}
.sb-mini-box{flex:1;min-height:0;position:relative}
.sb-mini-box svg{position:absolute;inset:0;width:100%;height:100%;display:block;overflow:visible}
.sb-cmp-tools{margin:0;text-align:center}
.sb-cmp-wrap{flex:none}
.sb-cmp-side{display:flex;flex-direction:column;gap:10px}
body:not(.sb-is-compare) .sb-cmp-side{display:none}
table.sb-cmp th[scope=row]{font:600 12.5px/1.3 var(--font-body);text-transform:none;letter-spacing:0;color:var(--ink)}
table.sb-cmp td{text-align:right}
table.sb-cmp td.val{font-size:13px}
table.sb-cmp th{text-align:right}
table.sb-cmp th:first-child{text-align:left}
.sb-pays h2{margin:0 0 6px;font:600 11.5px/1 var(--font-display);letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.sb-pay{display:grid;grid-template-columns:56px minmax(0,1fr);gap:2px 8px;align-items:center;margin-bottom:6px}
.sb-pay .lab{font:600 12.5px/1.2 var(--font-display);color:var(--ink);grid-row:span 2}
.sb-bar{display:flex;height:14px;border-radius:3px;background:var(--panel-2);overflow:hidden}
.sb-bar span{display:block;height:100%;transition:width .3s}
.sb-bar-cons{background:var(--pay-cons)}
.sb-bar-tax{background:var(--pay-tax)}
.sb-pay-t{font:500 11.5px/1.2 var(--font-mono);color:var(--muted)}
.sb-key{margin:2px 0 0;display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.sb-key i{display:inline-block;width:11px;height:11px;border-radius:2px}
.sb-cmp-note{margin:0;font-size:13.5px;line-height:1.45;color:var(--ink-soft);flex:none}
.sb-cmp-note b{color:var(--ink)}

@media (max-width:900px),(max-height:559px){
  .sb-compare{overflow:visible}
  .sb-minis{flex:none}
  .sb-mini-box{flex:none;aspect-ratio:600/510}
}
@media (max-width:900px){
  .sb-presets .btn{min-height:40px}
  .sb-types button{min-height:40px}
}
@media (max-width:640px){
  .sb-minis{grid-template-columns:1fr}
  .sb-cmp-wrap{grid-template-columns:1fr}
  .sb-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
}
