/* =============================================================
   graphs.css — two interactive home sections, built native to
   the Iaroslav Mezin design system (site.css tokens reused).
     1. .nn-*  "What I bring to the table"  (neural-network diagram)
     2. .sg-*  "Skill graph"                (categorised node graph)
   Vanilla. No build step, no framework, no localStorage.
   ============================================================= */

/* category palette — shared chroma/lightness, hue varied (oklch) */
:root {
  --cat-core: oklch(0.70 0.12 28);    /* red    */
  --cat-tech: oklch(0.72 0.10 236);   /* blue   */
  --cat-fw:   oklch(0.74 0.10 158);   /* green  */
  --cat-cert: oklch(0.79 0.11 80);    /* amber  */
}
:root[data-theme="light"] {
  --cat-core: oklch(0.55 0.15 28);
  --cat-tech: oklch(0.52 0.13 250);
  --cat-fw:   oklch(0.52 0.12 158);
  --cat-cert: oklch(0.58 0.13 70);
}

/* ---------- shared: glass orb + label + edges ---------- */
.node { position: absolute; }
.orb {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--c) 46%, var(--hair-2));
  background:
    radial-gradient(125% 125% at 30% 24%, color-mix(in oklab, var(--c) 30%, transparent), transparent 68%),
    color-mix(in oklab, var(--panel-2) 86%, var(--bg-1));
  box-shadow:
    0 6px 22px rgba(0,0,0,.34),
    inset 0 0 18px color-mix(in oklab, var(--c) 14%, transparent);
  color: color-mix(in oklab, var(--c) 72%, var(--ink));
  cursor: pointer; padding: 0; outline: 0;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow .25s var(--ease), border-color .25s var(--ease),
              transform .2s var(--ease), opacity .28s var(--ease);
}
.orb::before {
  content: ""; position: absolute; inset: 14%;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(60% 50% at 32% 26%, color-mix(in oklab, #fff 16%, transparent), transparent 70%);
}
:root[data-theme="light"] .orb::before { background: radial-gradient(60% 50% at 32% 26%, color-mix(in oklab,#fff 55%, transparent), transparent 70%); }
.orb svg { width: 42%; height: 42%; position: relative; z-index: 1; }
.orb:hover, .orb:focus-visible {
  border-color: var(--c);
  box-shadow:
    0 0 0 1px var(--c),
    0 0 26px color-mix(in oklab, var(--c) 42%, transparent),
    inset 0 0 22px color-mix(in oklab, var(--c) 20%, transparent);
}

.node-label {
  position: absolute; left: 50%; top: calc(100% + 7px);
  transform: translateX(-50%);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.01em;
  color: var(--ink-2); white-space: nowrap; pointer-events: none;
  transition: color .25s var(--ease);
}

/* edges (svg lines) */
.edge { stroke-width: 1; fill: none; transition: stroke-opacity .45s var(--ease), opacity .28s var(--ease), filter .45s var(--ease); }

/* idle cascade pulse — a travelling light that sweeps the edges in a loop.
   Class is added briefly then removed; the long stroke-opacity transition
   makes it fade out, so a moving comet/trail forms on its own. */
.edge.pulse {
  stroke-opacity: .92;
  stroke-width: 1.6;
  filter: drop-shadow(0 0 4px currentColor);
  transition: stroke-opacity .12s var(--ease), filter .12s var(--ease), stroke-width .12s var(--ease);
}

/* focus dimming, shared behaviour */
.is-focusing .node:not(.is-lit) { opacity: .2; }
.is-focusing .edge:not(.is-lit) { opacity: .05; }
.node.is-lit .node-label { color: var(--ink); }
.node.is-lit .orb { transform: scale(1.06); }

/* node entrance pop (opacity stays 1 — freeze-safe) */
@keyframes orbPop { from { transform: scale(.5); } to { transform: scale(1); } }
@media (prefers-reduced-motion: no-preference) {
  .node.pop .orb { animation: orbPop .5s var(--ease) both; }
}

/* =============================================================
   1. Neural-network section
   ============================================================= */
.nn-sec { padding-bottom: calc(var(--u) * 6 * var(--d)); }
.nn-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 6px 0 26px; flex-wrap: wrap; }
.nn-title {
  font-family: var(--display); font-size: clamp(22px, 3vw, 31px);
  font-weight: 500; letter-spacing: -0.015em; max-width: 22ch; line-height: 1.12;
}
.nn-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-2); background: var(--panel); cursor: pointer;
  border: 1px solid var(--hair-2); border-radius: 999px; padding: 8px 13px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
  white-space: nowrap;
}
.nn-toggle:hover { color: var(--ink); border-color: var(--hair-3); }
.nn-toggle__dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 9px var(--accent);
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.nn-toggle[aria-pressed="false"] .nn-toggle__dot { background: var(--ink-3); box-shadow: none; }

.nn-stage {
  position: relative; width: 100%;
  height: clamp(420px, 52vw, 480px);
  border: 1px solid var(--hair); border-radius: var(--r-lg);
  background:
    radial-gradient(120% 120% at 50% 0%, color-mix(in oklab, var(--accent) 5%, transparent), transparent 60%),
    var(--panel);
  overflow: hidden;
}
.nn-edges { position: absolute; inset: 0; width: 100%; height: 100%; }
.nn-col-h {
  position: absolute; transform: translateX(-50%); top: 16px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 600;
}
.nn-col-h.is-in { color: color-mix(in oklab, var(--accent-2) 80%, var(--ink-3)); }
.nn-col-h.is-skill, .nn-col-h.is-output { color: color-mix(in oklab, var(--accent) 70%, var(--ink-3)); }
.nn-cap, .sg-cap {
  margin-top: 16px; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.04em; color: var(--ink-3);
}

/* =============================================================
   2. Skill-graph section (full-bleed)
   ============================================================= */
.sg-fullbleed { width: 100vw; position: relative; left: 50%; margin-left: -50vw; }
.sg-inner { width: min(100% - 40px, 1280px); margin-inline: auto; }
.sg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 6px 0 22px; flex-wrap: wrap; }
.sg-title {
  font-family: var(--display); font-size: clamp(22px, 3vw, 31px);
  font-weight: 500; letter-spacing: -0.015em; max-width: 24ch;
}
.sg-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.sg-leg {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-2); background: none;
  border: 0; padding: 4px 2px; transition: color .2s var(--ease), opacity .2s var(--ease);
}
.sg-leg:hover { color: var(--ink); }
.sg-leg__sw { width: 11px; height: 11px; border-radius: 3px; flex: none; background: var(--c); box-shadow: 0 0 8px color-mix(in oklab, var(--c) 60%, transparent); }
.sg-leg.is-off { opacity: .38; }

.sg-stage {
  position: relative; width: 100%;
  height: clamp(560px, 60vw, 760px);
  border: 1px solid var(--hair); border-radius: var(--r-lg);
  background:
    radial-gradient(100% 80% at 50% 0%, color-mix(in oklab, var(--accent) 4%, transparent), transparent 60%),
    var(--panel);
  overflow: hidden; touch-action: none;
}
.sg-edges { position: absolute; inset: 0; width: 100%; height: 100%; }
.sg-boxes { position: absolute; inset: 0; pointer-events: none; }
.sg-box {
  position: absolute; border: 1px dashed color-mix(in oklab, var(--c) 42%, var(--hair-2));
  border-radius: var(--r); background: color-mix(in oklab, var(--c) 4%, transparent);
}
.sg-box__h {
  position: absolute; top: 10px; left: 12px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; font-weight: 600; color: color-mix(in oklab, var(--c) 70%, var(--ink-2));
}
.sg-nodes .node .orb { cursor: grab; }
.sg-nodes .node.dragging { z-index: 50; }
.sg-nodes .node.dragging .orb { cursor: grabbing; box-shadow: 0 0 0 1px var(--c), 0 0 30px color-mix(in oklab, var(--c) 50%, transparent), inset 0 0 22px color-mix(in oklab, var(--c) 22%, transparent); }
.sg-nodes .node-label { font-size: 10.5px; max-width: 13ch; white-space: normal; text-align: center; line-height: 1.2; }

/* ---------- skill-graph drawer (reuses .drawer / .drawer-scrim styling) ---------- */
.sg-drawer__cat { display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: color-mix(in oklab, var(--c) 72%, var(--ink)); }
.sg-drawer__cat .dotc { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: 0 0 9px color-mix(in oklab, var(--c) 60%, transparent); }
.sg-drawer .rel-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-chip {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.03em;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in oklab, var(--rc) 40%, var(--hair-2));
  color: color-mix(in oklab, var(--rc) 66%, var(--ink-1));
  background: color-mix(in oklab, var(--rc) 7%, transparent);
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.rel-chip:hover { border-color: var(--rc); color: var(--ink); background: color-mix(in oklab, var(--rc) 14%, transparent); }

/* =============================================================
   Section-1 modal (centered card)
   ============================================================= */
.nn-modal-scrim {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: center;
  padding: 24px; background: rgba(0,0,0,.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .28s var(--ease);
}
.nn-modal-scrim.open { opacity: 1; pointer-events: auto; }
.nn-modal {
  width: min(460px, 100%);
  background: var(--bg-1); border: 1px solid var(--hair-2); border-radius: var(--r-lg);
  box-shadow: 0 40px 110px rgba(0,0,0,.6);
  padding: 30px 30px 32px; position: relative;
  transform: translateY(10px) scale(.98); transition: transform .3s var(--ease);
}
.nn-modal-scrim.open .nn-modal { transform: none; }
.nn-modal__ic {
  width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center;
  border: 1px solid color-mix(in oklab, var(--c) 46%, var(--hair-2));
  background: radial-gradient(120% 120% at 30% 24%, color-mix(in oklab, var(--c) 26%, transparent), transparent 70%), var(--panel-2);
  color: color-mix(in oklab, var(--c) 76%, var(--ink)); margin-bottom: 18px;
}
.nn-modal__ic svg { width: 24px; height: 24px; }
.nn-modal__cat { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: color-mix(in oklab, var(--c) 70%, var(--ink-2)); font-weight: 600; }
.nn-modal__tag { font-family: var(--display); font-size: clamp(21px, 3vw, 26px); font-weight: 500; letter-spacing: -0.01em; margin-top: 10px; line-height: 1.18; }
.nn-modal__body { color: var(--ink-1); font-size: calc(16px * var(--d)); line-height: 1.62; margin-top: 14px; text-wrap: pretty; }
.nn-modal__x {
  position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; cursor: pointer; font-size: 14px;
  border: 1px solid var(--hair-2); background: var(--panel); color: var(--ink-2);
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.nn-modal__x:hover { color: var(--ink); border-color: var(--hair-3); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .nn-stage { height: 460px; }
  .node-label { font-size: 10px; }
  .sg-nodes .node-label { font-size: 9.5px; }
  .sg-stage { height: clamp(620px, 150vw, 820px); }
}
@media (max-width: 520px) {
  .nn-head, .sg-head { gap: 12px; }
}
