/* Skillzify Flowchart Lab v2 — page styles.
   Trace classes (.fc-trace-*) are deliberately MORE specific than
   Mermaid's own node selectors and contain no !important: the old
   page lost a specificity war against Mermaid's injected styles;
   this file wins it by selector weight (.fc-stage svg g.node.…). */

/* Token bridge (redesign v2 rollout): this file was written against
   --glass / --border / --bg2, which the shared system never defined,
   so those values silently fell back. Bridge them to the real v2
   tokens so the Lab sits in the same system as every other page. */
:root { --glass: var(--bg-soft); --border: var(--card-border); --bg2: var(--bg-soft); }

.fc-hero { position: relative; padding: 24px 0 8px; }
.fc-eyebrow { display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.fc-eyebrow::before { content: ""; width: 22px; height: 2px;
  background: var(--accent); border-radius: 2px; }
.fc-title { font-size: clamp(25px, 3.6vw, 34px); line-height: 1.08;
  margin: 0 0 10px; font-weight: 800; letter-spacing: -.01em;
  color: var(--text); }
.fc-title .grad { background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.fc-sub { color: var(--muted); max-width: 640px; margin: 0 0 18px;
  font-size: 15.5px; line-height: 1.55; }

.fc-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 6px 0 22px; align-items: start; }
.fc-how .step { background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start; }
.fc-how .n { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; }
.fc-how h3 { margin: 1px 0 3px; font-size: 14.5px; color: var(--text); }
.fc-how p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

.fc-grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.5fr);
  gap: 16px; align-items: start; }
/* The utility cards (static checks, AI help, export) live in the RIGHT
   work column under the chart (16 Nov 2026): as a separate row under
   the two columns they left a tall blank beside Run/Output, because
   the left column (editor + run) is far taller than the empty stage. */
.fc-col { display: grid; gap: 16px; min-width: 0; }
.fc-card { background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; min-width: 0; }
.fc-card h2 { margin: 0 0 4px; font-size: 16.5px; color: var(--text);
  display: flex; align-items: center; gap: 8px; }
.fc-card h2 svg { color: var(--accent); }
.fc-card .fc-cardsub { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.fc-muted { color: var(--muted); font-size: 13px; }

.fc-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 10px; }
.fc-toolbar .sp { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 7px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--glass); color: var(--text);
  padding: 7px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn.primary { background: var(--gradient); border-color: transparent;
  color: #fff; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn svg { flex: 0 0 auto; }
.fc-select, .fc-textinput { background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  font-size: 13px; font-family: inherit; }
.fc-textinput { border-radius: 10px; width: 100%; }

.fc-samples-wrap { position: relative; }
.fc-samples-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px; min-width: 210px;
  box-shadow: 0 22px 50px -18px rgba(0,0,0,.55); display: grid; gap: 2px; }
.fc-sample { text-align: left; background: none; border: 0; color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 13.5px; cursor: pointer;
  font-family: inherit; }
.fc-samples-pop[hidden] { display: none; }
.fc-sample:hover { background: var(--glass); }

/* fixed-size boxes (Vikas, 14 Nov 2026): the editor, output and AI
   boxes never resize with their content — content scrolls INSIDE
   the box, so pasting long code can't spread a card over the page. */
#fcEditorWrap .CodeMirror { border-radius: 10px; border: 1px solid var(--border);
  font-size: 13.5px; height: 400px; }
#fcCode { width: 100%; height: 400px; resize: none; background: var(--bg2);
  color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13.5px;
  padding: 12px; }

.fc-loadnote { display: flex; gap: 8px; align-items: center; color: var(--muted);
  font-size: 13px; margin-top: 10px; }
/* [hidden] guards: an author `display` value beats the UA's
   [hidden]{display:none}, so every class that both sets display and
   is toggled via the hidden attribute needs its own guard — the
   samples dropdown (.fc-samples-pop) was the first instance of this
   bug class; these are the rest. */
.fc-loadnote[hidden] { display: none; }
.fc-fnbar[hidden] { display: none; }
.fc-stats[hidden] { display: none; }
.fc-trace-panel[hidden] { display: none; }
.fc-err[hidden] { display: none; }
.fc-ai-out[hidden] { display: none; }
.fc-card[hidden] { display: none; }
.fc-loadnote::before { content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: fcspin .8s linear infinite; }
@keyframes fcspin { to { transform: rotate(360deg); } }

.fc-err { border: 1px solid #e05a7a; background: rgba(224,90,122,.08);
  border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.fc-err-title { font-weight: 700; color: #ff8fa8; display: flex; gap: 7px;
  align-items: center; }
.fc-err p { margin: 6px 0 0; font-size: 13.5px; color: var(--text); }
.fc-err-hint { color: var(--muted) !important; font-size: 12.5px !important; }

.fc-fnbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.fc-fn-btn { border: 1px solid var(--border); background: var(--glass);
  color: var(--muted); border-radius: 999px; padding: 6px 13px;
  font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.fc-fn-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fc-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.fc-stat { background: var(--bg2); border: 1px solid var(--border);
  color: var(--muted); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; }
.fc-stat b { color: var(--text); }

.fc-stage-shell { position: relative; border: 1px solid var(--border);
  border-radius: 10px; background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0/22px 22px,
    var(--bg2); overflow: hidden; }
/* round 4: the viewport is the SVG's own viewBox (see
   flowchart-app.js) — the shell never scrolls natively, the wrap
   carries no transform, and the stage has a definite height that
   the svg fills completely. */
.fc-scroll { overflow: hidden; max-height: 640px; cursor: grab; }
.fc-scroll:active { cursor: grabbing; }
.fc-stage { height: 560px; }
/* Before anything is generated the stage is just an invitation — the
   full 560px viewport reads as a big empty box. Shrink the stage to
   fit the empty state; the moment a chart renders, flowchart-app.js
   replaces #fcStage's contents (the .fc-empty node goes away), this
   rule stops matching and the stage returns to the full 560px before
   any viewBox fitting reads its size. */
.fc-stage:has(.fc-empty) { height: 300px; }
.fc-stage svg { width: 100%; height: 100%; display: block; }
/* The global .node rule (Learn-path buttons, style.css) also leaks
   font-size:1.7rem + font-weight:800 into Mermaid's <g class="node">
   groups — inert as box properties on a <g>, but they INHERIT into
   the labels, so chart text rendered bold and oversized and spilled
   out of the boxes Mermaid sized for 16px (visible in the stage and
   in the Lab Sheet PDF). Neutralise the leak on chart SVGs. */
.fc-stage svg g.node, #fcPrintSheet svg g.node {
  font-size: 16px; font-weight: 400; }
.fc-zoom { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px;
  z-index: 5; }
.fc-zoom .btn { padding: 7px 9px; background: var(--card); }
.fc-empty { text-align: center; padding: 30px 20px; color: var(--muted); }
.fc-empty .big { font-size: 15px; color: var(--text); font-weight: 700;
  margin: 0 0 5px; }
.fc-empty p { margin: 0; font-size: 13px; }
.fc-node-click { cursor: pointer; }

/* — living trace states: higher specificity than Mermaid's .node styles — */
.fc-stage svg g.node.fc-trace-current > rect,
.fc-stage svg g.node.fc-trace-current > polygon,
.fc-stage svg g.node.fc-trace-current > circle,
.fc-stage svg g.node.fc-trace-current > path {
  stroke: #ffd23e; stroke-width: 3.5px;
  filter: drop-shadow(0 0 4px rgba(255, 210, 62, .55)); }
.fc-stage svg g.node.fc-trace-done > rect,
.fc-stage svg g.node.fc-trace-done > polygon,
.fc-stage svg g.node.fc-trace-done > circle,
.fc-stage svg g.node.fc-trace-done > path {
  stroke: #3ac98f; stroke-width: 2.4px; }
.fc-stage svg g.node.fc-trace-dim { opacity: .32; }
.fc-stage svg path.fc-edge-done { stroke: #3ac98f; stroke-width: 2.8px; }
.fc-stage svg g.node.fc-flash > rect,
.fc-stage svg g.node.fc-flash > polygon,
.fc-stage svg g.node.fc-flash > circle {
  stroke: var(--accent); stroke-width: 3px; }
.fc-loop-badge { fill: #ffd23e; font-size: 11px; font-weight: 800;
  paint-order: stroke; stroke: rgba(0,0,0,.45); stroke-width: 3px; }
/* the trace's current line in the editor: a CodeMirror line class,
   NOT a selection — selecting would scroll the page on every step */
#fcEditorWrap .CodeMirror-linebackground.fc-trace-line {
  background: color-mix(in srgb, var(--accent) 16%, transparent); }

.fc-trace-panel { margin-top: 14px; border-top: 1px dashed var(--border);
  padding-top: 14px; }
.fc-trace-controls { display: flex; align-items: center; gap: 7px;
  flex-wrap: wrap; }
.fc-trace-controls .btn { padding: 7px 10px; }
#traceRange { flex: 1; min-width: 120px; accent-color: var(--accent); }
.fc-trace-meta { display: flex; justify-content: space-between; gap: 10px;
  color: var(--muted); font-size: 12.5px; margin-top: 8px; flex-wrap: wrap; }
.fc-vartable { width: 100%; border-collapse: collapse; margin-top: 10px;
  font-size: 13px; }
.fc-vartable td { border-top: 1px solid var(--border); padding: 6px 8px;
  vertical-align: top; }
.fc-vname { font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--accent); font-weight: 700; width: 38%; }
.fc-vval { font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--text); word-break: break-all; }

.fc-out { background: #070b1d; color: #d7ffe9; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; height: 132px; overflow: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px;
  white-space: pre-wrap; word-break: break-word; margin: 0; }
.fc-input-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.fc-input-label { color: var(--muted); font-size: 12.5px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap; max-width: 45%; overflow: hidden;
  text-overflow: ellipsis; }
.fc-input-line { flex: 1; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; }
.fc-mini { border: 1px solid var(--border); background: var(--glass);
  color: var(--text); border-radius: 9px; padding: 7px 11px; font-size: 12.5px;
  cursor: pointer; font-family: inherit; }
.fc-mini.danger { color: #ff8fa8; }

.fc-warn { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fc-warn li { display: flex; gap: 8px; align-items: flex-start;
  background: rgba(232,178,58,.08); border: 1px solid rgba(232,178,58,.35);
  border-radius: 10px; padding: 9px 11px; font-size: 13px; color: var(--text); }
.fc-warn li svg { color: #e8b23a; flex: 0 0 auto; margin-top: 1px; }

.fc-ai-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fc-ai-out { margin-top: 12px; border-top: 1px dashed var(--border);
  padding-top: 12px; max-height: 340px; overflow: auto; }
.fc-ai-text { white-space: pre-wrap; font-size: 14px; line-height: 1.65;
  color: var(--text); }
.fc-export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fc-export-grid .btn { justify-content: center; }
.fc-export-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.fc-export-row .fc-select { flex: 1; }

.fc-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%)
  translateY(16px); background: var(--card); color: var(--text);
  border: 1px solid var(--accent); border-radius: 10px; padding: 10px 18px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; z-index: 200;
  box-shadow: 0 18px 44px -12px rgba(0,0,0,.6); max-width: 92vw;
  text-align: center; }
.fc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

#fcPrintSheet { display: none; }
@media (max-width: 980px) {
  .fc-grid { grid-template-columns: 1fr; }
  .fc-how { grid-template-columns: 1fr; }
  .fc-stage { height: 420px; }
  .fc-ai-btns, .fc-export-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .fc-ai-btns, .fc-export-grid { grid-template-columns: 1fr; }
  .fc-title { font-size: 24px; }
}

/* — Lab Sheet print layout — */
@media print {
  body.fc-printing header, body.fc-printing nav, body.fc-printing footer,
  body.fc-printing .fc-app, body.fc-printing #siteNav, body.fc-printing #siteFooter {
    display: none !important; }
  /* The site-wide toast is position:fixed and hidden on screen only
     by a translateY slide-down — in print it lands on EVERY page as
     a blank pill (Vikas's phone PDF, 14 Nov 2026). Keep all toasts
     out of the sheet. */
  body.fc-printing .toast, body.fc-printing .fc-toast {
    display: none !important; }
  body.fc-printing #fcPrintSheet { display: block !important; color: #111; }
  body.fc-printing { background: #fff !important; }
  #fcPrintSheet h1 { font-size: 20px; margin: 0 0 2px; }
  #fcPrintSheet .ps-meta { color: #555; font-size: 12px; margin-bottom: 14px; }
  #fcPrintSheet h2 { font-size: 13px; text-transform: uppercase;
    letter-spacing: .1em; color: #444; margin: 16px 0 6px; }
  #fcPrintSheet pre { border: 1px solid #ccc; border-radius: 6px;
    padding: 10px 12px; font-size: 11.5px; white-space: pre-wrap;
    font-family: ui-monospace, monospace; }
  /* The exported SVG markup carries inline pixel width/height (needed
     for the PNG/SVG files); in print those MUST be overridden or a
     large chart keeps its pixel width, overflows the page and its
     content is centred off-page — the sheet came out blank but for
     one node (Vikas's phone PDF, 14 Nov 2026). !important beats the
     inline style; the viewBox keeps the drawing proportional and
     max-height keeps a tall chart on one page. */
  #fcPrintSheet svg { width: 100% !important; height: auto !important;
    max-width: 100%; }
  /* every chart in the sheet gets its own page after the first;
     a chart's heading stays with its chart */
  #fcPrintSheet .ps-chart + .ps-chart { break-before: page; }
  #fcPrintSheet .ps-chart h2 { break-after: avoid; }
  /* One chart, one page: cap the height so a tall chart scales to
     fit its page whole. (Letting it flow full-width across pages
     made Chrome strand a sliver fragment — a lone node cap —
     on an otherwise blank page.) */
  #fcPrintSheet .ps-chart svg { max-height: 240mm; }
}
@media (prefers-reduced-motion: reduce) {
  .fc-loadnote::before { animation: none; }
  .btn:hover { transform: none; }
}
