/* ══════════════════════════════════════════════════════════════════════
   Shared styles for the teacher tool pages (Math Magician's resources
   and Science Sage's). Each page sets its own --accent after this file;
   the default is Math Magician's lime.

   Graph Plotter:
   Build a Cartesian plane (range, increments, gridlines, axis labels),
   then plot any number of graphs on it in the CAPS standard forms —
   linear, parabola, hyperbola, exponential, logarithmic, trig, cubic,
   circle — or a free-typed y = … expression. The plot is a
   self-contained SVG, so what you see is exactly what downloads.

   Number Line:
   A single line with its own range, increments, small ticks and number
   format (decimals, fractions, mixed numbers), carrying points,
   inequalities / intervals and addition-subtraction jumps.

   Both pages parse what learners type with the small recursive-descent
   parser in plot-kit.js; nothing a user typed reaches eval() or
   new Function(). plot-kit.js also owns printing and copying.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --accent: var(--t-math);
  --font-display: "Cabinet Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --bad: #f87171;
}

/* ── Nav (same as the Math Magician landing page) ───────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-height: 68px; padding: 0 var(--gutter);
  background: rgb(8,9,11);
  
  
  border-bottom: 1px solid var(--line);
}
.nav-logo {
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  letter-spacing: -0.025em; color: var(--paper);
  text-decoration: none; display: flex; align-items: center; gap: 9px;
}
.nav-logo i, .nav-logo svg { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-full);
  border: 1px solid var(--line); background: transparent;
  color: var(--text-2);
  font-family: var(--font-body); font-size: 13px; font-weight: 700; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
}
.nav-back:hover { color: var(--paper); border-color: var(--line-hard); background: rgba(255,255,255,0.04); }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  width: 100%; max-width: var(--measure); margin-inline: auto;
  padding: clamp(28px, 4vw, 48px) var(--gutter) var(--space-5);
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: var(--space-3);
  font-family:inherit; font-size:12px; font-weight: 500;
   text-transform:none; color: var(--text-3);
}
.hero-tag-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.hero h1 {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(30px, 4.2vw, 48px); line-height: 1.02;
  letter-spacing: -0.04em; color: var(--paper); margin-bottom: var(--space-3);
}
.hero h1 em { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.02em; color: var(--text); }
.hero-sub { font-size: 15.5px; line-height: 1.6; color: var(--text-2); max-width: 66ch; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.gp {
  display: grid; grid-template-columns: minmax(300px, 410px) minmax(0, 1fr);
  gap: var(--space-5); align-items: start;
  /* Wider than the site measure so the drawing area can use a big screen
     (about 1100 px of plot at 1920 wide, still fitting a 4:3 plane on screen). */
  width: 100%; max-width: 1600px; margin-inline: auto;
  padding: 0 var(--gutter) var(--space-8);
}
.gp-controls { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.gp-stage { position: sticky; top: 84px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); }
@media (max-width: 980px) {
  .gp { grid-template-columns: minmax(0, 1fr); }
  .gp-stage { position: static; order: -1; }
}

/* ── Panels ─────────────────────────────────────────────────────────── */
.panel {
  background: var(--ink-850); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: var(--space-4);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.panel h2 {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  letter-spacing: -0.02em; color: var(--paper);
}
.panel h2 i, .panel h2 svg { color: var(--accent); }
.hint { font-size: 12.5px; line-height: 1.55; color: var(--text-3); }
.hint code, .tips code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text); background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; }

.row { display: grid; gap: var(--space-2); margin-bottom: var(--space-3); }
.row.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.row.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.row.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > input.pslider { width: 100%; height: 22px; margin: 2px 0 0; padding: 0; accent-color: var(--gc, var(--accent, #9ed43c)); background: transparent; border: none; cursor: pointer; }
.field > span {
  font-family:inherit; font-size:12px; font-weight: 500;
   text-transform:none; color: var(--text-3);
}
.field > span.var { font-family: var(--font-serif); font-style: italic; font-size: 16px; letter-spacing: 0; text-transform: none; color: var(--text); line-height: 1; }
input[type=text], input[type=number], select {
  width: 100%; min-width: 0;
  padding: 8px 10px; border-radius: var(--radius-2xs);
  background: var(--ink-900); border: 1px solid var(--line-hard);
  color: var(--paper); font-family: var(--font-mono); font-size: 13px;
}
select { font-family: var(--font-body); font-size: 13.5px; cursor: pointer; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.err { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--ink-900)); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: var(--space-3); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 13px; border-radius: var(--radius-2xs);
  border: 1px solid var(--line-hard); background: transparent;
  color: var(--text); font-family: var(--font-body); font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.btn:hover { background: rgba(255,255,255,0.05); border-color: var(--paper); color: var(--paper); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0d1400; }
.btn.primary:hover { background: #b4e25a; border-color: #b4e25a; color: #0d1400; }
.btn.icon { padding: 6px; border-color: var(--line); color: var(--text-3); }
.btn.icon:hover { color: var(--paper); }
.btn.icon.danger:hover { color: var(--bad); border-color: var(--bad); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ── Graph cards ────────────────────────────────────────────────────── */
.glist { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-3); }
.gcard {
  border: 1px solid var(--line); border-left: 3px solid var(--gc, var(--accent));
  border-radius: var(--radius-sm); padding: var(--space-3); background: var(--ink-900);
}
.gcard.off { opacity: 0.55; }
.gcard-top { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-2); }
.gcard-top input[type=color] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line-hard); border-radius: 6px; background: none; cursor: pointer; flex-shrink: 0; }
.gcard-top .gname { width: 46px; flex-shrink: 0; text-align: center; font-family: var(--font-serif); font-style: italic; font-size: 17px; padding: 4px; }
.gcard-top select { flex: 1; }
.eq {
  font-family: var(--font-serif); font-size: 19px; color: var(--paper);
  padding: 6px 2px 10px; overflow-x: auto; white-space: nowrap;
}
.eq i { font-style: italic; }
.eq sup { font-size: 0.68em; }
.eq.err { font-family: var(--font-mono); font-size: 12px; color: var(--bad); white-space: normal; }
details.more { margin-top: 2px; }
details.more > summary {
  cursor: pointer; list-style: none;
  font-family:inherit; font-size:12px;  text-transform:none; color: var(--text-3);
  padding: 4px 0;
}
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }
details.more > summary:hover { color: var(--paper); }
details.more .inner { padding-top: var(--space-2); }
.empty { font-size: 13px; color: var(--text-3); padding: var(--space-3); border: 1px dashed var(--line-hard); border-radius: var(--radius-sm); text-align: center; }

.prow { display: grid; grid-template-columns: 30px 52px minmax(0,1fr) minmax(0,1fr) 30px; gap: 6px; align-items: center; margin-bottom: 6px; }
.prow input[type=color] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line-hard); border-radius: 6px; background: none; cursor: pointer; }
.prow .pname { text-align: center; }

/* ── Plot stage ─────────────────────────────────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.toolbar .spacer { flex: 1; }
.plot-wrap {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--line-hard); background: #fff; box-shadow: var(--elevation-md);
}
.plot-wrap.dark { background: #0c0e11; }
#plot svg { display: block; width: 100%; height: auto; cursor: crosshair; }
.readout {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2);
  min-height: 20px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center;
}
.readout b { color: var(--paper); font-weight: 600; }
.readout .sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.warn { font-size: 12.5px; color: #fbbf24; }
.warn:empty { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  background: var(--ink-800); border: 1px solid var(--line-hard); color: var(--text);
  padding: 10px 18px; border-radius: 11px; font-size: 13px; box-shadow: var(--elevation-lg);
  opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms; z-index: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tips { font-size: 13px; line-height: 1.65; color: var(--text-2); }
.tips ul { padding-left: 18px; margin: 6px 0 0; }
.tips li { margin-bottom: 4px; }

footer {
  margin-top: auto; padding: var(--space-7) var(--gutter);
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.footer-copy { font-size: 13px; color: var(--text-3); }

@media (max-width: 520px) {
  .row.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .row.c3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .prow { grid-template-columns: 30px 44px minmax(0,1fr) minmax(0,1fr) 30px; }
}

@media print {
  nav, .hero, .gp-controls, .toolbar, .readout, .warn, footer, .ml-skip, .toast, .ml-contact-fab { display: none !important; }
  body { background: #fff !important; }
  .gp { display: block; padding: 0; }
  .gp-stage { position: static; }
  .plot-wrap { border: none; box-shadow: none; }
}
