@import url("https://fonts.googleapis.com/css?family=Google+Sans:400,500,700|Noto+Sans:400,700");
/* Theme: academic project page in the Nerfies / Bulma style (https://nerfies.github.io/).
 * Google Sans headings, Noto Sans body, #4a4a4a text on white, Bulma link blue #3273dc as the one
 * accent (selection, neighbours, upload, active tab), light grey rules, square corners. */
:root {
  --ink: #363636;
  --ink-2: #4a4a4a;
  --muted: #6b6b6b;
  --rule: #dbdbdb;
  --hair: #ededed;
  --tint: #f5f5f5;
  --accent: #3273dc;
  --paper: #fff;
  --plot-train: #c4c4c4;
  --plot-held: #4a4a4a;
  --plot-api: #e07b00;
  --api-ink: #9a5200;
  --plot-rule: #e6e6e6;
  --bar-h: 44px;
  --foot-h: 28px;
  --font: "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; border-radius: 0; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); overflow: hidden; font: 13px/1.45 var(--font); }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
code { font: 11.5px var(--mono); color: var(--ink-2); }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.2px; margin: 0 0 10px; }
h3 { font-size: 15px; font-weight: 700; margin: 16px 0 6px; }
h4 { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.9px; color: var(--ink); margin: 16px 0 6px; }
.sub { color: var(--muted); font-size: 11.5px; }
ul.plain { margin: 6px 0; padding-left: 14px; }
ul.plain li { margin: 2px 0; }
ul.plain li::marker { content: "–  "; color: var(--muted); }
.note { border-left: 2px solid var(--ink); padding: 2px 0 2px 10px; margin: 10px 0; }
.note li::marker { content: "–  "; }

/* top bar */
.bar { height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 2px solid var(--ink); }
.brand b { font-size: 17px; font-weight: 800; letter-spacing: 0.5px; margin-right: 14px; }
.brand span { color: var(--muted); font-size: 12px; }
.bar-actions { display: flex; gap: 18px; }
button { font: inherit; color: inherit; }
.link { background: none; border: 0; padding: 0; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink); text-decoration: none; }
.link:hover { color: var(--accent); }

/* three panes */
.ide { display: grid; grid-template-columns: 310px minmax(0, 1fr) 420px; height: calc(100vh - var(--bar-h) - var(--foot-h)); }
.pane { overflow-y: auto; min-height: 0; }
.left { border-right: 1px solid var(--ink); padding: 0 14px 20px; }
.right { border-left: 1px solid var(--ink); padding: 0 16px 20px; }
.middle { display: flex; flex-direction: column; overflow: hidden; }
.pane-title { position: sticky; top: 0; z-index: 2; background: var(--paper); font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 12px 0 8px; }
.pane-title.inline { position: static; padding: 0; margin-right: auto; }

/* segmented controls: square, hairline, active = black fill */
.seg { display: inline-flex; border: 1px solid var(--ink); }
.seg button { border: 0; background: var(--paper); padding: 4px 10px; cursor: pointer; font-size: 12px; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button:hover { background: var(--tint); }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg.two-path { display: flex; margin: 2px 0 12px; }
.seg.two-path button { flex: 1; padding: 8px 6px; font-weight: 700; font-size: 12.5px; }

/* left: examples */
.examples { display: flex; flex-direction: column; border-top: 1px solid var(--ink); margin: 10px 0 14px; }
.example { text-align: left; border: 0; border-bottom: 1px solid var(--rule); background: var(--paper); padding: 7px 0 7px 10px; cursor: pointer; display: flex; flex-direction: column; border-left: 3px solid transparent; }
.example:hover { background: var(--tint); }
.example b { font-size: 10px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted); font-weight: 700; }
.example span { font-size: 12.5px; word-break: break-all; }
.example.on { border-left-color: var(--accent); }
.example.on b { color: var(--accent); }
.field-label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.9px; margin-bottom: 4px; }
#pick { width: 100%; padding: 6px 8px; font: inherit; border: 1px solid var(--ink); background: var(--paper); }
#pick:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* left: upload */
.file { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--ink); padding: 7px 9px; margin-top: 10px; font-weight: 700; font-size: 12px; }
.file em { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 4px; }
.file input { font: 11.5px var(--font); max-width: 100%; }
.links { font-size: 11px; color: var(--muted); margin: 4px 0 0; line-height: 1.45; }
details.how { margin: 12px 0 4px; font-size: 12px; }
details.how summary { cursor: pointer; font-weight: 700; }
.primary { margin-top: 12px; width: 100%; background: var(--ink); color: var(--paper); border: 0; padding: 9px; font-weight: 700; letter-spacing: 0.4px; cursor: pointer; }
.primary:hover { background: var(--accent); }
.primary:disabled { background: var(--muted); cursor: wait; }
.pipeline { list-style: none; padding: 0; margin: 12px 0 8px; counter-reset: s; border-top: 1px solid var(--rule); }
.pipeline li { counter-increment: s; padding: 4px 0; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--hair); }
.pipeline li::before { content: counter(s, decimal-leading-zero); display: inline-block; width: 26px; font-variant-numeric: tabular-nums; }
.pipeline li.active { color: var(--ink); font-weight: 700; }
.pipeline li.active::before { color: var(--accent); }
.pipeline li.done { color: var(--ink); }
.pipeline li.done::after { content: "done"; float: right; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; }
.pipeline li.skipped { color: #bbb; text-decoration: line-through; }
.pipeline li.error { color: var(--accent); font-weight: 700; }
.pipeline li.error::after { content: "error"; float: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; }
.progress { height: 2px; background: var(--hair); }
#bar { height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }
#stage { margin: 4px 0 8px; min-height: 16px; }
.errors { border-left: 2px solid var(--accent); padding: 2px 0 2px 10px; color: var(--ink); font-size: 12px; }
.errors h4 { color: var(--accent); margin-top: 2px; }
.errors ul { padding-left: 16px; margin: 4px 0; }
.ok { border-left: 2px solid var(--ink); padding: 2px 0 2px 10px; font-size: 12px; }
ul.warn { color: var(--ink-2); font-size: 12px; padding-left: 16px; }

/* middle: plot */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.canvas-wrap { position: relative; flex: 1; min-height: 0; }
#plot { width: 100%; height: 100%; display: block; touch-action: none; }
.tooltip { position: absolute; pointer-events: none; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); padding: 5px 8px; font-size: 11.5px; max-width: 320px; word-break: break-all; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 6px 12px 0; font-size: 11.5px; border-top: 1px solid var(--rule); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.lg i.ring { background: var(--paper) !important; border: 2px solid var(--accent); width: 10px; height: 10px; }
.lg i.square { border-radius: 0; outline: 1px solid var(--ink); }
.lg i.diamond { border-radius: 0; width: 8px; height: 8px; transform: rotate(45deg); outline: 1px solid var(--ink); margin: 0 1px; }
.caption { margin: 4px 12px 8px; padding-left: 14px; font-size: 11px; color: var(--muted); columns: 2; column-gap: 24px; }
.caption li::marker { content: "–  "; }

/* right: inspector */
.insp-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.insp-head h3 { word-break: break-all; margin: 0; width: 100%; font-size: 16px; }
.tabs { display: flex; border-bottom: 1px solid var(--ink); margin: 12px 0 4px; position: sticky; top: 34px; background: var(--paper); z-index: 1; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; padding: 6px 8px 5px; cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 700; }
.tabs button:first-child { padding-left: 0; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.story { border-top: 2px solid var(--ink); padding: 8px 0 2px; margin: 10px 0 6px; }
.story .kind { font-size: 10px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--accent); font-weight: 700; }
.story h4 { margin: 2px 0 4px; text-transform: none; letter-spacing: 0; font-size: 14px; }
.story ul { margin: 4px 0 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px; border-bottom: 1px solid var(--ink); padding: 4px 5px; vertical-align: bottom; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl td { border-bottom: 1px solid var(--hair); padding: 4px 5px; vertical-align: top; }
.tbl td a { word-break: break-all; text-decoration: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover { background: var(--tint); }
.tbl tr.clickable:hover a { color: var(--accent); }
.strong { font-weight: 700; }
.tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; white-space: nowrap; color: var(--muted); }
.tag.held { color: var(--ink); }
.tag.up { color: var(--accent); }
.tag.api { color: var(--api-ink); }

/* dialogs and footer */
dialog { border: 2px solid var(--ink); padding: 22px 28px; max-width: 720px; color: var(--ink); font-size: 13px; }
dialog::backdrop { background: rgba(255, 255, 255, 0.82); }
dialog .close { position: absolute; right: 12px; top: 6px; border: 0; background: none; font-size: 22px; cursor: pointer; }
dialog .close:hover { color: var(--accent); }
.foot { height: var(--foot-h); border-top: 1px solid var(--ink); font-size: 11px; color: var(--muted); padding: 6px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot .code { margin-left: 14px; color: var(--ink); }

@media (max-width: 1100px) {
  body { overflow: auto; }
  .ide { grid-template-columns: 1fr; height: auto; }
  .middle { height: 70vh; }
  .caption { columns: 1; }
  .foot { height: auto; white-space: normal; }
}

/* project-page type and spacing (layered over the rules above) */
body { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.brand b, h2, h3, .insp-head h3, .story h4, .pane-title, .seg button, .tabs button, .primary, .link {
  font-family: "Google Sans", "Noto Sans", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent); }
.brand b { font-size: 22px; font-weight: 500; letter-spacing: 0; color: var(--ink); }
.bar { height: var(--bar-h); border-bottom: 1px solid var(--rule); }
.link { font-weight: 500; font-size: 14px; }
.left, .right { border-color: var(--rule); }
.left { background: #fafafa; }
.pane-title, h4, .field-label, .tbl th, .example b, .story .kind, .tag { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.pane-title { font-size: 15px; font-weight: 500; color: var(--ink); background: inherit; padding: 14px 0 10px; }
.left .pane-title { background: #fafafa; }
.seg { border-color: var(--rule); }
.seg button { font-size: 13px; }
.seg button + button { border-left-color: var(--rule); }
.seg button.on { background: var(--ink); color: #fff; }
.seg.two-path button { font-weight: 500; font-size: 14px; padding: 9px 6px; }
.examples { border-top-color: var(--rule); }
.example { background: transparent; padding: 9px 0 9px 10px; }
.example b { color: var(--muted); }
.example.on b { color: var(--accent); }
#pick, .file { border-color: var(--rule); background: #fff; }
.primary { background: var(--ink); font-weight: 500; font-size: 14px; }
.primary:hover { background: #000; }
#bar { background: var(--accent); }
.tbl th { border-bottom-color: var(--rule); color: var(--ink); }
.tabs { border-bottom-color: var(--rule); }
.tabs button { font-weight: 500; font-size: 14px; }
.story { border-top: 1px solid var(--rule); }
.story h4 { font-size: 17px; font-weight: 500; }
.note { border-left: 3px solid var(--rule); }
.tag.held { color: var(--ink); }
.foot { border-top-color: var(--rule); }
dialog { border: 1px solid var(--rule); }

/* fixes from the pane-by-pane check under this theme */
.tabs button { font-size: 13px; padding: 6px 7px 5px; }                 /* five tabs fit the 420px pane */
.tbl { font-size: 12.5px; }
.tbl td a { word-break: normal; overflow-wrap: anywhere; }             /* break model ids at - or /, not mid-word */
.tag { font-weight: 500; }
.errors { border-left-color: #cc0f35; }                                 /* errors in Bulma danger red, not the link blue */
.errors h4, .pipeline li.error, .pipeline li.error::before { color: #cc0f35; }

/* tables scroll inside their own box when a screen is too narrow (no page-level horizontal scroll) */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* ---------------------------------------------------------------- tablets and phones (<= 1100px)
 * The three panes stack at full width (input, embedding space, inspector) and the page scrolls as one.
 * Desktop (> 1100px) is unchanged. */
@media (max-width: 1100px) {
  html, body { height: auto; }
  body { overflow-x: hidden; overflow-y: auto; font-size: 15px; line-height: 1.55; }
  .bar { height: auto; flex-wrap: wrap; gap: 4px 16px; padding: 10px 16px; align-items: baseline; }
  .brand span { display: block; font-size: 13.5px; margin-top: 2px; }
  .bar-actions { gap: 4px 18px; flex-wrap: wrap; }
  .link { font-size: 15px; min-height: 40px; display: inline-flex; align-items: center; }
  .ide { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pane { overflow: visible; }
  .left, .right { border: 0; border-bottom: 1px solid var(--rule); padding: 0 16px 20px; }
  .left .pane-title, .left { background: #fafafa; }
  .middle { height: auto; overflow: visible; border-bottom: 1px solid var(--rule); }
  .canvas-wrap { flex: none; height: clamp(340px, 92vw, 600px); }
  #plot { touch-action: pan-y; }  /* vertical swipes scroll the page; horizontal drags move the view */
  .toolbar { gap: 8px 10px; padding: 10px 16px; }
  .pane-title.inline { width: 100%; }

  /* touch targets >= 40px */
  .seg button { min-height: 40px; padding: 6px 14px; font-size: 14px; }
  .seg.two-path button { min-height: 44px; font-size: 15px; }
  #reset-view { min-height: 40px; }
  #pick { min-height: 44px; font-size: 16px; }
  .file input { min-height: 40px; font-size: 14px; }
  details.how { font-size: 14px; }
  details.how summary { padding: 10px 0; font-size: 15px; }
  .primary { min-height: 44px; font-size: 16px; }
  .example { padding: 10px 0 10px 12px; }
  .example span { font-size: 15px; }
  .tabs { flex-wrap: wrap; top: 0; }  /* all five tabs stay visible; they wrap to a second row on phones */
  .tabs button { min-height: 44px; font-size: 15px; padding: 8px 10px; white-space: nowrap; flex: none; }
  .tabs button:first-child { padding-left: 10px; }
  .pipeline li { font-size: 14px; padding: 7px 0; }
  .tbl tr.clickable td { padding-top: 10px; padding-bottom: 10px; }

  /* readable sizes */
  .sub, .links, .caption, .legend, .foot, ul.warn, .errors, .ok { font-size: 13.5px; }
  .tbl { font-size: 14px; }
  .tbl th, .tag, .field-label, .example b, .story .kind { font-size: 13px; }
  .tbl .sub { font-size: 13px; }
  .caption { columns: 1; margin: 6px 16px 12px; }
  .legend { padding: 8px 16px 0; }
  .insp-head h3 { font-size: 18px; overflow-wrap: anywhere; }
  .story h4 { font-size: 18px; }
  code { font-size: 13px; overflow-wrap: anywhere; }
  .links, .example span { overflow-wrap: anywhere; word-break: normal; }
  .foot { height: auto; white-space: normal; padding: 14px 16px 24px; line-height: 1.6; }
  .foot .code { display: block; margin: 6px 0 0; }
  dialog { width: calc(100vw - 20px); max-width: 720px; padding: 18px 16px; font-size: 15px; }
  .tbl.quoted td.num:last-child { white-space: normal; width: 38%; }
}

/* ---------------------------------------------------------------- framework strip and model card
 * One colour per term of e(m,q) = μ(q) + Λ(q)θ(m) + Γ(q)s(m) + ε, used by the strip, the card and the
 * Method dialog (KaTeX \htmlClass{v-*}). All four pass 4.5:1 on white; the link blue stays the selection colour. */
:root {
  --c-theta: #b5530c;
  --c-style: #8e3fa8;
  --c-mu: #2b7a4b;
  --c-eps: #6b6b6b;
}
.v-theta { color: var(--c-theta); }
.v-style { color: var(--c-style); }
.v-mu { color: var(--c-mu); }
.v-eps { color: var(--c-eps); }
.katex { font-size: 1.08em; }

@media (min-width: 1101px) {
  body { display: flex; flex-direction: column; height: 100vh; }
  .ide { flex: 1 1 auto; height: auto; min-height: 0; }
  .bar, .framework, .foot { flex: none; }
}
.framework { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 22px; align-items: center;
  padding: 6px 16px; border-bottom: 1px solid var(--rule); background: #fcfcfc; }
.fw-eqs { display: flex; flex-direction: column; gap: 0; white-space: nowrap; }
.fw-eq .katex { font-size: 1.22em; }
.fw-eq.fw-bit .katex { font-size: 1.0em; }
.fw-vars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: 0 24px; font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.fw-vars li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-vars li { margin: 0; }
.fw-more { font-size: 12.5px; white-space: nowrap; color: var(--accent); }

/* card */
.desc-tag { font-size: 11.5px; color: var(--muted); border: 1px solid var(--rule); padding: 3px 8px; display: inline-block; margin: 8px 0 2px; }
.profile { margin-bottom: 10px; }
.profile .param { margin: 6px 0; }
.card-sec { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 2px; }
.card-sec > h4 { margin-top: 8px; }
.param { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 2px 10px; align-items: start; margin: 10px 0; }
.param .sym { font-size: 13px; padding-top: 1px; }
.param .val { font-size: 13px; }
.param .val b { font-weight: 700; }
.meter { position: relative; height: 8px; background: var(--hair); margin: 3px 0 1px; }
.meter > i { position: absolute; top: 0; bottom: 0; left: 0; background: var(--c-theta); }
.meter > u { position: absolute; top: -2px; bottom: -2px; background: rgba(181, 83, 12, 0.25); }
.bipolar { position: relative; height: 12px; margin: 4px 0 0; border-bottom: 1px solid var(--rule); }
.bipolar::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--muted); }
.bipolar > i { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--c-style); }
.poles { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); }
.poles span:last-child { text-align: right; }
.stack { display: flex; height: 10px; margin: 4px 0 2px; }
.stack > i { display: block; height: 100%; }
.stack .p-theta { background: var(--c-theta); }
.stack .p-style { background: var(--c-style); }
.stack .p-eps { background: #d6d6d6; }
.tbl .r2 { color: var(--muted); }
.tbl td .tex { white-space: nowrap; }
.tbl.small { font-size: 12px; }
.tbl tr.dropped td { color: var(--muted); }
#method { max-width: 860px; }
#method .tbl { margin: 6px 0 10px; }

.tabs button { padding: 6px 5px 5px; }                                /* six tabs fit the 420px pane */
@media (max-width: 1100px) {
  .fw-vars li { white-space: normal; }
  .framework { grid-template-columns: minmax(0, 1fr); padding: 10px 16px; }
  .fw-eqs { white-space: normal; overflow-x: auto; }
  .fw-vars { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; font-size: 14px; }
  .fw-more { min-height: 40px; display: inline-flex; align-items: center; font-size: 15px; }
  .poles, .desc-tag { font-size: 13px; }
  .param { grid-template-columns: 64px minmax(0, 1fr); }
  .param .val, .param .sym { font-size: 14.5px; }
  .tbl.small { font-size: 13.5px; }
}

/* symbols dialog and fixed inspector header */
.fw-bitrow { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fw-vars-dlg li { margin: 6px 0; }
.insp-sticky { position: sticky; top: 0; z-index: 3; background: var(--paper); padding-bottom: 2px; }
.insp-sticky .pane-title, .insp-sticky .tabs { position: static; }
@media (max-width: 1100px) {
  .insp-sticky { display: contents; }  /* phones: only the tabs stick, as before */
  .insp-sticky .tabs { position: sticky; top: 0; z-index: 3; }
}
.fw-headline { font-size: 13px; line-height: 1.4; color: var(--ink); max-width: 46em; }

/* in-dialog cross-links: make clickability obvious */
.dlg-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.dlg-link:hover { color: var(--accent); text-decoration-thickness: 2px; }
