/* =========================================================
   GRAPH PLOTTER (units/graphs.html, pages/graphs.js)
   ========================================================= */
.unit--graphs { --c: var(--purple); --c-soft: #efeaff; }
.gr__hero { padding-bottom: 2.2rem; }
.gr { padding: 1.6rem 0 3rem; }
.gr__body { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }

/* the list of equations */
.gr__panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem; display: grid; gap: .8rem; }
.gr__list { display: grid; gap: .45rem; }
.gr-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .45rem; border: 2px solid #ece9f8; border-radius: 14px; padding: .3rem .4rem; background: #fff; }
.gr-row:focus-within { border-color: var(--purple); }
.gr-row__dot { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 3px solid var(--dot); background: var(--dot); cursor: pointer; flex: none; }
.gr-row.is-hidden .gr-row__dot { background: #fff; }
.gr-row.is-hidden .gr-input { opacity: .5; }
.gr-row__field { min-width: 0; }
.gr-input { width: 100%; font-size: 1.15rem; border: none; outline: none; background: transparent; padding: .2rem .1rem; }
math-field.gr-input::part(menu-toggle) { display: none; }
.gr-input--plain { font: 600 1.05rem var(--font-body); }
.gr-row__del { border: none; background: none; color: var(--ink-soft); font-size: 1.35rem; line-height: 1; cursor: pointer; padding: .1rem .35rem; border-radius: 8px; }
.gr-row__del:hover { background: #f3f1fb; color: var(--ink); }
.gr-row__note { grid-column: 2 / 4; font-size: .85rem; font-weight: 700; margin: -.1rem 0 .15rem; }
.gr-row__note.is-error { color: #c92a50; }
.gr-row__note.is-hint { color: var(--ink-soft); font-weight: 600; }
.gr-row__note.is-value { color: var(--ink); font-size: 1rem; }
.gr__tools { display: flex; gap: .5rem; flex-wrap: wrap; }
.gr__tools .btn { padding: .5rem .95rem; font-size: .9rem; }

/* sliders */
.gr__sliders { display: grid; gap: .6rem; border-top: 2px dashed #ece9f8; padding-top: .7rem; }
.gr__sliders[hidden] { display: none; }
.gr-slider { display: grid; grid-template-columns: 1fr; gap: .2rem; }
.gr-slider__name { font-weight: 800; font-size: .95rem; }
.gr-slider input[type=range] { width: 100%; accent-color: var(--purple); }
.gr-slider__ends { display: flex; justify-content: space-between; gap: .5rem; }
.gr-slider__ends input { width: 4.6rem; font: 700 .8rem var(--font-body); color: var(--ink-soft); border: 1.5px solid #e6e3f3; border-radius: 8px; padding: .15rem .35rem; }
.gr-slider__ends input:last-child { text-align: right; }

/* help */
.gr__help { border-top: 2px dashed #ece9f8; padding-top: .6rem; }
.gr__help summary { cursor: pointer; font-weight: 800; color: var(--purple); }
.gr__examples { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.gr__examples button { border: 2px solid #ece9f8; background: #faf9ff; border-radius: 999px; padding: .3rem .7rem; font: 700 .88rem var(--font-body); color: var(--ink); cursor: pointer; }
.gr__examples button:hover { border-color: var(--purple); }
.gr__tips { font-size: .88rem; color: var(--ink-soft); line-height: 1.55; }

/* the graph */
.gr__graph { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; position: sticky; top: 84px; }
.gr__bar { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-bottom: 2px solid #f1eff9; }
.gr__readout { flex: 1; text-align: center; font: 700 .85rem var(--font-body); color: var(--ink-soft); font-variant-numeric: tabular-nums; min-height: 1.2em; }
.gr__zoom { display: flex; gap: .3rem; }
.gr__btn { border: 2px solid #ece9f8; background: #fff; border-radius: 10px; min-width: 2.2rem; height: 2.2rem; font: 800 1.05rem var(--font-body); color: var(--ink); cursor: pointer; padding: 0 .55rem; }
.gr__btn:hover { border-color: var(--purple); }
.gr__btn--mode { font-size: .85rem; }
.gr__btn--mode[aria-pressed="true"] { background: var(--c-soft); border-color: var(--purple); }
.gr__canvas { position: relative; height: min(70vh, 640px); min-height: 360px; touch-action: none; }
.gr__canvas canvas { display: block; cursor: grab; }
.gr__canvas canvas:active { cursor: grabbing; }
.gr__canvas canvas:focus-visible { outline: 3px solid var(--purple); outline-offset: -3px; }
.gr__tip { position: absolute; pointer-events: none; background: #fff; border: 2px solid var(--purple); border-radius: 10px; padding: .15rem .5rem; font: 800 .85rem var(--font-body); color: var(--ink); box-shadow: 0 4px 12px rgba(29, 27, 58, .12); white-space: nowrap; }

@media (max-width: 900px) {
  .gr__body { grid-template-columns: 1fr; }
  .gr__graph { position: static; order: -1; }
  .gr__canvas { height: 56vh; min-height: 300px; }
}
