/* Canvath — one stylesheet, no framework, no build step. */

:root {
  --bg: #070a14;
  --surface: rgba(20, 26, 45, 0.72);
  --surface-solid: #131a2c;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e9eefb;
  --muted: #93a0bb;
  --accent: #6d7cff;
  --accent-soft: rgba(109, 124, 255, 0.16);
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --rose: #fb7185;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

code { font-family: var(--mono); font-size: 0.9em; }
p code, li code { background: rgba(148, 163, 184, 0.12); padding: 1px 5px; border-radius: 5px; }

.aurora {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 18% 18%, rgba(109, 124, 255, 0.28), transparent 70%),
    radial-gradient(40% 50% at 80% 6%, rgba(34, 211, 238, 0.16), transparent 72%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px clamp(16px, 4vw, 48px);
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
}

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }

.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), var(--cyan));
  color: #06101f;
  font-weight: 800; font-size: 15px; letter-spacing: -0.02em;
  box-shadow: 0 10px 24px -12px rgba(109, 124, 255, 0.9);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16.5px; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; }

.nav { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 10, 20, 0.5); }

.nav-link {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; padding: 6px 14px; border-radius: 9px;
  cursor: pointer; transition: color 0.15s ease, background 0.15s ease;
}

.nav-link:hover { color: var(--text); }
.nav-link.is-active { background: var(--accent-soft); color: #c7cdff; }

.topbar-right { margin-left: auto; }

.health {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 12.5px; color: var(--muted);
}

.health i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12); }
.health[data-state="ok"] i { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.health[data-state="down"] i { background: var(--rose); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.18); }

/* ---------- layout ---------- */

main {
  position: relative; z-index: 1;
  width: 100%; max-width: 1160px;
  margin: 0 auto; padding: 8px clamp(16px, 4vw, 48px) 72px;
  flex: 1;
}

.view { display: none; }
.view.is-active { display: block; animation: fade 0.2s ease-out; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero { max-width: 760px; margin: 32px 0 40px; }

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(31px, 5.2vw, 50px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  background: linear-gradient(118deg, #ffffff 18%, #b9c4ff 56%, var(--cyan) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero p { margin: 0 0 20px; color: var(--muted); font-size: 15.5px; max-width: 66ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.section-head { margin: 26px 0 22px; }
.section-head h2 { margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -0.025em; }
.section-head p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------- buttons ---------- */

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 17px; border: 0; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: white; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 12px 28px -14px rgba(109, 124, 255, 0.95);
  transition: filter 0.15s ease, transform 0.12s ease;
}

.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }

.ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font: inherit; font-size: 13.5px; text-decoration: none;
  cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(148, 163, 184, 0.06); }

.link { border: 0; background: none; color: var(--cyan); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.icon {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon:hover { color: var(--text); background: rgba(148, 163, 184, 0.1); border-color: var(--line); }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field > span em { font-style: normal; opacity: 0.6; }

.field input, .field textarea, .field select, .toolbar select, .toolbar input {
  width: 100%; padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: rgba(7, 10, 20, 0.7); color: var(--text);
  font: inherit; font-size: 14px; outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea { resize: vertical; min-height: 160px; font-family: var(--mono); font-size: 13px; line-height: 1.6; }

.field input:focus, .field textarea:focus, .field select:focus, .toolbar input:focus {
  border-color: rgba(109, 124, 255, 0.7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-error { margin: 0; color: #fecdd3; font-size: 13px; }
.warning { color: #fde68a; font-size: 13px; margin: 8px 0 0; }
.muted { color: var(--muted); font-size: 14px; }
.row-end { display: flex; justify-content: flex-end; }

/* ---------- toolbar ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }

.search { position: relative; flex: 1 1 240px; min-width: 180px; }

.search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--muted);
  stroke-width: 2; stroke-linecap: round;
}

.search input { padding-left: 36px; }
.toolbar select { width: auto; cursor: pointer; }
.count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }

.tag {
  border: 1px solid var(--line); background: rgba(7, 10, 20, 0.5);
  color: var(--muted); font: inherit; font-size: 12.5px;
  padding: 4px 11px; border-radius: 999px; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tag:hover { color: var(--text); border-color: var(--line-strong); }
.tag.is-active { color: #c7cdff; border-color: rgba(109, 124, 255, 0.6); background: var(--accent-soft); }

/* ---------- skill grid ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }

.card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20, 26, 45, 0.86), rgba(11, 15, 27, 0.86));
  cursor: pointer; text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover { border-color: rgba(109, 124, 255, 0.5); transform: translateY(-2px); box-shadow: var(--shadow); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-title { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; }
.card-summary { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.card-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; color: var(--muted); font-size: 12px; }
.card-foot .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

.chip {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--line);
  font-size: 11px; color: var(--muted); white-space: nowrap;
}

.chip-accent { color: #a5b4fc; border-color: rgba(109, 124, 255, 0.4); background: rgba(109, 124, 255, 0.12); }

/* ---------- panels ---------- */

.panel {
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); backdrop-filter: blur(12px);
  padding: 20px;
}

.panel h3 { margin: 0 0 10px; font-size: 15.5px; letter-spacing: -0.01em; }
.panel h3:not(:first-child) { margin-top: 22px; }
.panel-quiet { background: rgba(7, 10, 20, 0.4); }

.publish-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.connect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }

.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  padding: 26px; text-align: center; margin-bottom: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop-title { margin: 0 0 4px; font-size: 14.5px; font-weight: 550; }
.drop-body { margin: 0; color: var(--muted); font-size: 13px; }

.ticks { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.ticks li { margin-bottom: 5px; }

/* ---------- code + key ---------- */

.code {
  margin: 0 0 10px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(4, 6, 12, 0.8);
  color: #cbd5e1; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.6; white-space: pre; overflow-x: auto;
}

.key-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: var(--radius-sm); background: rgba(52, 211, 153, 0.08);
}

.key-box code { flex: 1; font-size: 12.5px; color: #a7f3d0; overflow-wrap: anywhere; }
.who { margin-top: 10px; font-size: 13px; color: var(--muted); }
.who strong { color: var(--text); font-weight: 550; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }

/* ---------- empty ---------- */

.empty { padding: 56px 24px; text-align: center; }
.empty-title { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.empty-body { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

/* ---------- dialog ---------- */

.dialog {
  border: 1px solid var(--line-strong); border-radius: 20px;
  background: var(--surface-solid); color: var(--text); padding: 0;
  width: min(720px, calc(100vw - 28px)); max-height: 86vh;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.95);
}

.dialog::backdrop { background: rgba(4, 6, 12, 0.72); backdrop-filter: blur(4px); }

.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; max-height: 86vh; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0 0 2px; font-size: 20px; letter-spacing: -0.02em; }
.dialog-head p { margin: 0; font-size: 12.5px; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.dialog-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--line);
}

/* ---------- markdown ---------- */

.markdown { overflow-y: auto; font-size: 14.5px; line-height: 1.65; padding-right: 4px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { letter-spacing: -0.02em; margin: 20px 0 8px; line-height: 1.25; }
.markdown h1 { font-size: 22px; }
.markdown h2 { font-size: 18px; }
.markdown h3 { font-size: 16px; }
.markdown p { margin: 0 0 11px; }
.markdown ul, .markdown ol { margin: 0 0 12px; padding-left: 22px; }
.markdown li { margin-bottom: 4px; }
.markdown code { background: rgba(148, 163, 184, 0.14); padding: 1px 5px; border-radius: 5px; font-size: 0.88em; }
.markdown pre { background: rgba(4, 6, 12, 0.85); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; margin: 0 0 12px; }
.markdown pre code { background: none; padding: 0; font-size: 12.5px; }
.markdown blockquote { margin: 0 0 12px; padding: 6px 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.markdown a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.markdown table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 13.5px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }

/* ---------- toasts ---------- */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }

.toast {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface-solid); color: var(--text); font-size: 13.5px;
  box-shadow: var(--shadow); animation: toast-in 0.18s ease-out; max-width: 340px;
}

.toast.is-error { border-color: rgba(251, 113, 133, 0.45); color: #fecdd3; }
.toast.is-ok { border-color: rgba(52, 211, 153, 0.45); color: #a7f3d0; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- footer ---------- */

.footer {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  max-width: 1160px; width: 100%; margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 48px) 28px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .publish-grid, .connect-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .nav-link { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
  .hero { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
