/* ============================================================
   Config Forge — design tokens
   bg graphite-navy · violet signal accent · mint "secure" accent
   display: Space Mono · body: Inter · code: IBM Plex Mono
   ============================================================ */

:root{
  --bg:        #0b0e14;
  --panel:     #12161f;
  --panel-2:   #171c27;
  --border:    #262c3a;
  --border-lt: #333a4c;

  --text:      #e3e7f0;
  --text-dim:  #9aa3b5;
  --text-mute: #6b7386;

  --signal:    #7c8cff;   /* violet — interactive / data */
  --signal-dim:#4a52a8;
  --secure:    #3ddc97;   /* mint — encrypted / verified */
  --secure-dim:#1f7a58;
  --warn:      #e8a33d;
  --danger:    #ef5b5b;

  --font-display: 'Space Mono', ui-monospace, monospace;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-code: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 10px;
  --radius-sm: 6px;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(124,140,255,0.08), transparent 42%),
    radial-gradient(circle at 88% 30%, rgba(61,220,151,0.06), transparent 40%);
  background-attachment: fixed;
}

.noise{
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

code, pre{ font-family: var(--font-code); }

/* ---------- top bar ---------- */
.top{
  position: sticky; top:0; z-index: 20;
  background: rgba(11,14,20,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.top-inner{
  max-width: 1180px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.brand{ display:flex; align-items:center; gap:8px; }
.brand-mark{ color: var(--secure); display:flex; }
.brand-text{
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  letter-spacing: 0.02em;
}
.brand-accent{ color: var(--signal); }
.top-meta{ display:flex; gap:8px; flex-wrap: wrap; }
.pill{
  font-family: var(--font-code); font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--border-lt); border-radius: 999px;
  padding: 5px 12px; white-space: nowrap;
}
.pill-target{ color: var(--secure); border-color: var(--secure-dim); }

/* ---------- shell / layout ---------- */
.shell{
  max-width: 1180px; margin: 0 auto; padding: 48px 24px 80px;
  position: relative; z-index: 1;
}

.intro{ max-width: 720px; margin-bottom: 40px; }
.eyebrow{
  font-family: var(--font-code); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--signal); margin: 0 0 14px;
}
.intro h1{
  font-family: var(--font-display); font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15; margin: 0 0 16px; font-weight: 700; letter-spacing: -0.01em;
}
.lede{ color: var(--text-dim); font-size: 15.5px; margin: 0; }
.lede code{ color: var(--text); background: var(--panel-2); padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }

/* ---------- signal path (signature element) ---------- */
.signal-path{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 28px;
  margin-bottom: 40px;
  overflow-x: auto;
}
.path-track{
  display: flex; align-items: center; gap: 0;
  min-width: 620px;
}
.path-node{
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex-shrink: 0; width: 108px;
}
.node-dot{
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--panel-2); border: 2px solid var(--border-lt);
  transition: all 0.4s ease;
}
.path-node[data-state="active"] .node-dot{
  background: var(--secure); border-color: var(--secure);
  box-shadow: 0 0 0 4px rgba(61,220,151,0.15), 0 0 14px rgba(61,220,151,0.5);
}
.path-node[data-state="warn"] .node-dot{
  background: var(--warn); border-color: var(--warn);
  box-shadow: 0 0 0 4px rgba(232,163,61,0.15);
}
.node-label{
  font-family: var(--font-code); font-size: 11px; color: var(--text-mute);
  letter-spacing: 0.02em; text-align: center; transition: color 0.4s ease;
}
.path-node[data-state="active"] .node-label{ color: var(--text); }

.path-wire{
  flex: 1; height: 2px; background: var(--border);
  position: relative; margin: 0 -2px; top: -12px;
  min-width: 40px;
}
.path-wire[data-active="1"]{ background: var(--secure-dim); }
.wire-pulse{
  position: absolute; top: -2px; left: -6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--secure); opacity: 0;
}
.path-wire[data-active="1"] .wire-pulse{
  animation: pulse 1.8s linear infinite;
}
@keyframes pulse{
  0%{ left: -6px; opacity: 0; }
  10%{ opacity: 1; }
  90%{ opacity: 1; }
  100%{ left: 100%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce){
  .wire-pulse{ animation: none !important; opacity: 0 !important; }
}

/* ---------- workspace ---------- */
.workspace{
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  align-items: start;
}
@media (max-width: 980px){
  .workspace{ grid-template-columns: 1fr; }
}

.panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.panel-head{
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.panel-head-spaced{ margin-top: 32px; }
.panel-head h2{
  font-family: var(--font-display); font-size: 15px; margin: 0;
  color: var(--text);
}
.panel-sub{ font-size: 12px; color: var(--text-mute); font-family: var(--font-code); }

/* ---------- input ---------- */
.link-input{
  width: 100%; resize: vertical;
  background: #0d1017; color: var(--text);
  border: 1px solid var(--border-lt); border-radius: var(--radius-sm);
  padding: 14px; font-family: var(--font-code); font-size: 13px;
  line-height: 1.6;
}
.link-input:focus{ outline: none; border-color: var(--signal); }
.link-input::placeholder{ color: var(--text-mute); }

.input-row{ display:flex; align-items:center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

.btn{
  font-family: var(--font-code); font-size: 13px; font-weight: 500;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-primary{ background: var(--signal); color: #0b0e14; font-weight: 700; }
.btn-primary:hover{ background: #909dff; }
.btn-primary:disabled{ background: var(--border-lt); color: var(--text-mute); cursor: not-allowed; }
.btn-ghost{ background: transparent; color: var(--text-dim); border-color: var(--border-lt); }
.btn-ghost:hover{ color: var(--text); border-color: var(--signal); }
.btn-ghost:disabled{ color: var(--text-mute); cursor: not-allowed; border-color: var(--border); }
.btn-sm{ padding: 7px 14px; font-size: 12px; }

.parse-status{ font-size: 12.5px; color: var(--text-mute); font-family: var(--font-code); }
.parse-status.ok{ color: var(--secure); }
.parse-status.err{ color: var(--danger); }

.link-results{ margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.link-card{
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.link-card.err{ border-color: rgba(239,91,91,0.4); }
.link-card-main{ min-width: 0; }
.link-card-name{ font-size: 13px; font-weight: 600; color: var(--text); }
.link-card-detail{ font-size: 11.5px; color: var(--text-mute); font-family: var(--font-code); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-card-badge{
  font-family: var(--font-code); font-size: 10.5px; padding: 3px 9px; border-radius: 999px;
  flex-shrink: 0;
}
.badge-ok{ background: rgba(61,220,151,0.12); color: var(--secure); }
.badge-err{ background: rgba(239,91,91,0.12); color: var(--danger); }

/* ---------- options ---------- */
.options-grid{
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
@media (max-width: 620px){ .options-grid{ grid-template-columns: 1fr; } }

.opt-group{
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin: 0; min-width: 0;
}
.opt-group legend{
  font-family: var(--font-code); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-mute); padding: 0 6px;
}
.opt-group-wide{ grid-column: 1 / -1; }
.legend-note{ text-transform: none; letter-spacing: normal; color: var(--text-mute); font-size: 11px; }
.bypass-input{
  width: 100%; resize: vertical;
  background: #0d1017; color: var(--text);
  border: 1px solid var(--border-lt); border-radius: var(--radius-sm);
  padding: 10px; font-family: var(--font-code); font-size: 12.5px; line-height: 1.6;
  margin-top: 2px;
}
.bypass-input:focus{ outline: none; border-color: var(--signal); }
.field-label-hint{ margin-top: 8px; font-size: 11.5px; }
.field-label-hint code{ color: var(--text-dim); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

.field{ display: block; margin-top: 12px; }
.field:first-of-type{ margin-top: 4px; }
.field-label{ display:block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.field-label small{ display:block; color: var(--text-mute); font-weight: 400; margin-top: 2px; }
.field input[type="text"], .field input[type="number"], .field select, .field-sub{
  width: 100%; background: #0d1017; color: var(--text);
  border: 1px solid var(--border-lt); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13px; font-family: var(--font-code);
}
.field-sub{ margin-top: 8px; }
.field select{ font-family: var(--font-body); }
.field input:focus, .field select:focus{ outline: none; border-color: var(--signal); }
.field-inline{ display:flex; align-items:center; gap: 10px; }
.field-inline .field-label{ margin-bottom:0; white-space: nowrap; }

.toggle{
  display: grid; grid-template-columns: 36px 1fr; align-items: start;
  gap: 10px; margin-top: 14px; cursor: pointer;
}
.toggle input{ position:absolute; opacity:0; width:0; height:0; }
.toggle-track{
  width: 36px; height: 20px; border-radius: 999px; background: var(--border-lt);
  position: relative; transition: background 0.2s ease; margin-top: 2px;
}
.toggle-thumb{
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-dim); transition: all 0.2s ease;
}
.toggle input:checked + .toggle-track{ background: var(--secure-dim); }
.toggle input:checked + .toggle-track .toggle-thumb{ transform: translateX(16px); background: var(--secure); }
.toggle input:focus-visible + .toggle-track{ outline: 2px solid var(--signal); outline-offset: 2px; }
.toggle-text{ font-size: 13px; color: var(--text); }
.toggle-text small{ display:block; color: var(--text-mute); font-size: 11.5px; font-weight: 400; margin-top: 2px; }

/* ---------- output ---------- */
.output-panel{ position: sticky; top: 84px; }
.output-actions{ display:flex; gap: 8px; }
.warnings{
  background: rgba(232,163,61,0.08); border: 1px solid rgba(232,163,61,0.35);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px;
  font-size: 12.5px; color: var(--warn); font-family: var(--font-code);
}
.warnings ul{ margin: 6px 0 0; padding-left: 18px; }
.warnings li{ margin-top: 4px; }

.output-code{
  background: #0a0c12; border: 1px solid var(--border-lt); border-radius: var(--radius-sm);
  padding: 18px; margin: 0; max-height: 640px; overflow: auto;
  font-size: 12.5px; line-height: 1.65; color: var(--text-dim);
}
.output-code code{ color: inherit; }
.tok-key{ color: #9ab8ff; }
.tok-str{ color: var(--secure); }
.tok-num{ color: var(--warn); }
.tok-bool{ color: #ef8fef; }
.tok-punc{ color: var(--text-mute); }

/* ---------- notes ---------- */
.notes{ margin-top: 56px; }
.notes h2{
  font-family: var(--font-display); font-size: 14px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-mute); margin: 0 0 18px;
}
.notes-grid{
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px;
}
@media (max-width: 780px){ .notes-grid{ grid-template-columns: 1fr; } }
.note{
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px; background: var(--panel);
}
.note h3{ font-size: 14px; margin: 0 0 8px; color: var(--text); }
.note p{ font-size: 13px; color: var(--text-dim); margin: 0; line-height: 1.6; }
.note code{ color: var(--secure); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }

/* ---------- footer ---------- */
.site-footer{
  margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-mute);
}
.site-footer code{ color: var(--text-dim); }
