/* Page-scoped extension of the existing AMS / Memos reader. */
.lf-note .lf-source-text > :is(p, h2, h3, h4, .equation-block) {
  width: min(74ch, 100%);
  margin-inline: auto;
}
.lf-note .lf-source-text p { margin-block: 1.15rem; overflow-wrap: break-word; }
.lf-note .lf-source-text h4 {
  margin-block: 2.6rem 1.1rem;
  color: var(--marble);
  font: 400 1rem/1.5 "Unbounded", sans-serif;
}
.lf-note :is(h2, h3, h4, .equation-block) { scroll-margin-top: 100px; }
.lf-note .equation-block {
  overflow-x: auto;
  overflow-y: hidden;
  margin-block: 1.8rem;
  padding: 8px 3px;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}
.lf-note .equation-block mjx-container[display="true"] { margin: 0.75em 0; }
.lf-note .lf-inline-math {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: middle;
  scrollbar-width: thin;
}
.lf-note .lf-ref { display: inline; min-height: 0; }
.lf-note .lf-figure {
  --lf-blue: #8deaff;
  --lf-orange: #ffb778;
  --lf-green: #a9deb1;
  margin-block: clamp(38px, 6vw, 62px);
  padding-block: 28px;
  border-block: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.lf-note .lf-figure h4 { margin: 0 0 8px; }
.lf-note .lf-figure h3 { margin-top: 0; }
.lf-note .lf-intro { max-width: 70ch; }
.lf-note .lf-controls {
  display: grid;
  grid-template-columns: minmax(155px, auto) minmax(100px, 1fr) auto;
  align-items: center;
  gap: 12px 22px;
  margin-block: 24px 12px;
  font-size: 0.86rem;
  color: var(--marble);
}
.lf-note .lf-controls output { color: var(--focus); margin-left: 10px; }
.lf-note input[type="range"] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--focus); cursor: pointer; }
.lf-note .lf-presets { display: flex; gap: 10px; }
.lf-note button {
  min-height: 44px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 0;
  background: transparent;
  color: var(--marble);
  font: inherit;
  cursor: pointer;
}
.lf-note button:hover:not(:disabled) { border-color: var(--focus); color: var(--focus); }
.lf-note button:disabled { opacity: 0.5; cursor: default; }
.lf-note .lf-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
.lf-note .lf-panel { min-width: 0; }
.lf-note .lf-chart { display: block; width: 100%; height: auto; touch-action: pan-y; }
.lf-note .lf-chart text { fill: var(--marble-soft); font: 12px "Sora", sans-serif; }
.lf-note .lf-grid { stroke: var(--line); stroke-width: 0.65; }
.lf-note .lf-axis { stroke: var(--marble-muted); stroke-width: 1; }
.lf-note .lf-curve { fill: none; stroke-width: 2.6; stroke-linejoin: round; }
.lf-note .lf-blue { stroke: var(--lf-blue); }
.lf-note .lf-orange { stroke: var(--lf-orange); }
.lf-note .lf-green { stroke: var(--lf-green); }
.lf-note .lf-dashed { stroke-dasharray: 7 5; }
.lf-note .lf-dotted { stroke-dasharray: 2 5; }
.lf-note .lf-region { fill: var(--lf-blue); opacity: 0.065; }
.lf-note .lf-boundary { stroke: var(--lf-blue); stroke-width: 1; stroke-dasharray: 2 5; opacity: 0.7; }
.lf-note .lf-marker { fill: var(--marble); stroke: var(--aegean); stroke-width: 2; }
.lf-note .lf-guide { stroke: var(--marble-muted); stroke-width: 1; stroke-dasharray: 4 5; }
.lf-note .lf-sample { fill: none; stroke-width: 1; opacity: 0.28; }
.lf-note .lf-stationary { stroke: var(--marble); stroke-width: 1.4; stroke-dasharray: 2 5; }
.lf-note .lf-readout { min-height: 3.5em; color: var(--marble); font-size: 0.88rem; line-height: 1.75; }
.lf-note .lf-time-panel { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 26px; }
.lf-note .lf-legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 10px 0 16px; font-size: 0.8rem; }
.lf-note .lf-legend span { display: inline-flex; align-items: center; gap: 8px; }
.lf-note .lf-legend i { width: 23px; border-top: 2px solid var(--lf-blue); }
.lf-note .lf-legend .lf-legend-orange { border-color: var(--lf-orange); }
.lf-note .lf-legend .lf-legend-drift { border-color: var(--lf-orange); border-top-style: dashed; }
.lf-note .lf-legend .lf-legend-ito { border-color: var(--lf-green); border-top-style: dotted; }
.lf-note .lf-legend .lf-legend-stationary { border-color: var(--marble); border-top-style: dotted; }
.lf-note .lf-ensemble-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-block: 20px; font-size: 0.85rem; }
.lf-note .lf-switch { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; color: var(--marble); }
.lf-note .lf-switch input {
  appearance: none;
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 26px;
  margin: 0;
  border: 1px solid var(--marble-muted);
  border-radius: 0;
  background: var(--aegean);
  cursor: pointer;
}
.lf-note .lf-switch input::before { content: ""; position: absolute; width: 16px; height: 16px; top: 4px; left: 4px; background: var(--marble-muted); }
.lf-note .lf-switch input:checked { border-color: var(--focus); }
.lf-note .lf-switch input:checked::before { left: 22px; background: var(--focus); }
.lf-note :is(.lf-help, figcaption, .lf-original) { color: var(--marble-muted); font-size: 0.83rem; line-height: 1.7; }
.lf-note .lf-help { margin: 8px 0; }
.lf-note figcaption { max-width: 74ch; margin: 22px auto 0; }
.lf-note .lf-original { margin-top: 20px; }
.lf-note summary { min-height: 44px; padding-block: 10px; color: var(--marble); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.lf-note .lf-original img { height: auto; max-height: none; margin-block: 18px; }
.lf-note [hidden] { display: none !important; }
.lf-note :is(input, button, summary, .equation-block, .lf-inline-math):focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.lf-note .lf-skip { position: fixed; z-index: 10; left: 20px; top: -100px; padding: 12px 18px; background: var(--marble); color: var(--aegean); }
.lf-note .lf-skip:focus { top: 10px; }
.lf-note .lf-skip:not(:focus) { clip-path: inset(50%); }
@media (max-width: 700px) {
  .lf-note .lf-panels { grid-template-columns: 1fr; gap: 28px; }
  .lf-note .lf-controls { grid-template-columns: 1fr; gap: 2px; }
  .lf-note .lf-presets { margin-top: 6px; }
  .lf-note .lf-readout { min-height: 5.3em; }
  .lf-note .equation-block { font-size: 0.88em; }
  .lf-note .lf-legend { gap: 8px 16px; }
}
@media print {
  .lf-note :is(.memo-return, .lf-skip, .lf-live, .lf-original, .site-footer) { display: none !important; }
  .lf-note .lf-fallback[hidden] { display: block !important; }
  .lf-note .memo-page { padding-top: 0; }
}
