/* =====================================================
   Berzeker -- argument-map editor, dark gothic theme.
   ===================================================== */

@font-face {
  font-family: "Aurusenthial";
  src: url("./assets/fonts/AurusenthialGothic.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0d0a08;
  --bg-elev: #15110e;
  --bg-elev-2: #1d1814;
  --line: #2d2420;
  --line-strong: #3d3528;
  --ink: #f0ebe2;
  --ink-dim: #a89e90;
  --ink-faint: #6f6557;
  --accent: #b8231f;
  --accent-hot: #ff4d3d;
  --accent-soft: rgba(184, 35, 31, 0.16);
  --gold: #c4a35a;
  --bad: #d65560;
  --good: #6fb87a;

  --display: "Aurusenthial", "Cinzel", "Trajan Pro", Georgia, serif;
  --serif: "Source Serif Pro", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

/* hidden attribute must actually hide */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  width: 100%;
  height: 100%;
  overflow: hidden;
}

kbd {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  margin: 0 1px;
}

/* =================== editor shell =================== */
.editor-shell {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100vh;
  width: 100vw;
}

.editor-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(184,35,31,0.06) 0%, transparent 100%);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.brand-name {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.05em;
  text-shadow: 0 0 14px rgba(184, 35, 31, 0.4);
}
.editor-tagline {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: lowercase;
}

/* ---- mini wobbling eye in the top bar (32px scale) ---- */
.logo-wobble-mini {
  position: relative;
  width: 32px;
  height: 32px;
}
.logo-wobble-mini .logo-wobble-strip {
  position: absolute;
  left: 0;
  width: 32px;
  overflow: hidden;
}
.logo-wobble-mini .logo-wobble-strip img {
  position: absolute;
  left: 0;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.logo-wobble-mini .s-top { top: 0;   height: 11px; animation: wobbleTop 8s ease-in-out infinite; }
.logo-wobble-mini .s-top img { top: 0; }
.logo-wobble-mini .s-mid { top: 11px; height: 10px; }
.logo-wobble-mini .s-mid img { top: -11px; }
.logo-wobble-mini .s-bot { top: 21px; height: 11px; animation: wobbleBot 8s ease-in-out infinite; }
.logo-wobble-mini .s-bot img { top: -21px; }

@keyframes wobbleTop {
  0%   { transform: translateX(0); }
  8%   { transform: translateX(-1px); }
  16%  { transform: translateX(0.5px); }
  24%  { transform: translateX(-1.5px); }
  32%  { transform: translateX(0.5px); }
  48%  { transform: translateX(1px); }
  64%  { transform: translateX(1.5px); }
  80%  { transform: translateX(0.5px); }
  100% { transform: translateX(0); }
}
@keyframes wobbleBot {
  0%   { transform: translateX(0); }
  8%   { transform: translateX(1px); }
  16%  { transform: translateX(-0.5px); }
  24%  { transform: translateX(1px); }
  32%  { transform: translateX(-1.5px); }
  48%  { transform: translateX(-1px); }
  64%  { transform: translateX(-0.5px); }
  80%  { transform: translateX(1px); }
  100% { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .logo-wobble-mini .s-top, .logo-wobble-mini .s-bot { animation: none; }
}

/* =================== toolbar =================== */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.tb-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.04em;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.tb-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.tb-btn.mode-btn.active {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.tb-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 6px;
}
.tb-edgekind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tb-swatch {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

/* =================== canvas =================== */
.editor-canvas-wrap {
  position: relative;
  background:
    radial-gradient(circle at 20% 30%, rgba(184,35,31,0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(196,163,90,0.04) 0%, transparent 50%),
    var(--bg);
  overflow: hidden;
}
.editor-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}
.editor-canvas.cursor-grab { cursor: grab; }
.editor-canvas.cursor-add { cursor: crosshair; }
.editor-canvas.cursor-connect { cursor: crosshair; }

/* faint dot grid behind the canvas */
.editor-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

/* =================== nodes & edges =================== */
.argmap-node {
  cursor: grab;
}
.argmap-node:active { cursor: grabbing; }
.argmap-node:hover rect {
  stroke: var(--line-strong);
}
.argmap-node.selected rect {
  stroke: var(--accent);
  filter: drop-shadow(0 0 8px rgba(184, 35, 31, 0.45));
}
.argmap-node.conn-origin rect {
  stroke: var(--gold);
  filter: drop-shadow(0 0 8px rgba(196, 163, 90, 0.55));
}
.argmap-edge {
  /* The visible path itself is non-interactive -- clicks go through the
     wider invisible .argmap-edge-hit sibling. */
  pointer-events: none;
}
.argmap-edge.selected {
  filter: drop-shadow(0 0 6px rgba(184, 35, 31, 0.55));
}
.argmap-edge-hit {
  pointer-events: stroke;
  cursor: pointer;
}

/* =================== inline edit textarea =================== */
.argmap-edit {
  position: fixed;
  z-index: 10;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink);
  background: var(--bg-elev-2);
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 8px 10px;
  resize: none;
  outline: none;
  box-shadow: 0 0 14px rgba(184, 35, 31, 0.4);
}

/* =================== empty hint =================== */
.empty-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(21, 17, 14, 0.85);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 460px;
  width: calc(100% - 32px);
  pointer-events: none;
  text-align: left;
}
.empty-hint h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 0 0 14px;
  text-align: center;
  text-shadow: 0 0 12px rgba(184, 35, 31, 0.35);
}
.empty-hint ol {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.55;
}
.empty-hint ol li { margin-bottom: 6px; }
.empty-hint p.muted {
  font-size: 11px;
  color: var(--ink-faint);
  margin: 0;
  text-align: center;
  letter-spacing: 0.02em;
}

/* =================== error banner =================== */
.error-banner {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(214, 85, 96, 0.15);
  border: 1px solid var(--bad);
  color: #ffd9dc;
  padding: 10px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 50;
}
.error-banner button {
  background: transparent;
  border: none;
  color: var(--bad);
  font-size: 18px;
  cursor: pointer;
}

/* =================== responsive =================== */
@media (max-width: 640px) {
  .editor-tagline { display: none; }
  .editor-toolbar { overflow-x: auto; white-space: nowrap; }
  .tb-btn { padding: 7px 10px; font-size: 11px; }
}
