/* ===========================================================================
   Portfolio — latent space.
   Dark canvas · cyan/violet accents · monospace utility type · inter for prose.
   =========================================================================== */

:root {
  --bg: #07080c;
  --bg-1: #0b0d14;
  --bg-2: #11141d;
  --line: rgba(180, 200, 240, 0.08);
  --line-strong: rgba(180, 200, 240, 0.18);
  --fg: #e6ebf5;
  --fg-dim: #9ba6b9;
  --fg-faint: #5e6678;
  --accent: oklch(0.78 0.14 230);     /* electric cyan */
  --accent-2: oklch(0.74 0.16 305);   /* violet */
  --accent-soft: oklch(0.78 0.14 230 / 0.18);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* subtle vignette + radial glow so the canvas reads as a "field" */
  background-image:
    radial-gradient(
      ellipse 80% 60% at 60% 30%,
      rgba(80, 120, 220, 0.08),
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 50% at 30% 80%,
      rgba(150, 80, 220, 0.06),
      transparent 60%
    ),
    linear-gradient(180deg, #06070b 0%, #04050a 100%);
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--fg); }

/* ----- Layout ------------------------------------------------------------ */

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100vh;
  width: 100vw;
  position: relative;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
}

/* ----- Sidebar ----------------------------------------------------------- */

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 14, 22, 0.9), rgba(8, 9, 14, 0.95));
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  position: relative;
  z-index: 5;
}

.sidebar::after {
  /* a thin vertical scanline to push the "context window" feel */
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--accent-soft) 30%,
    var(--accent-soft) 70%,
    transparent
  );
}

.sb-block { display: flex; flex-direction: column; gap: 10px; }

.sb-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-faint);
  text-transform: lowercase;
}

.sb-name {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.01em;
  margin: 0;
  background: linear-gradient(135deg, #e6ebf5 0%, #b9c7e8 60%, #c5b3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sb-role {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}

.sb-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-faint);
}
.sb-meta > span,
.sb-meta > a { display: inline-flex; align-items: center; }
.sb-meta a { color: var(--fg-dim); border-bottom: 1px dotted var(--line-strong); }
.sb-meta a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.sb-cv {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg);
  background: rgba(255,255,255,0.02);
  transition: all 0.15s;
  align-self: flex-start;
}
.sb-cv:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.sb-cv-icon { color: var(--accent); }

.sb-prompt {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.015);
  position: relative;
}
.sb-prompt::before {
  content: "";
  position: absolute;
  left: -1px; top: 12px;
  width: 2px; height: calc(100% - 24px);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  opacity: 0.6;
}

.sb-tagline {
  font-size: 14.5px;
  color: var(--fg);
  margin: 4px 0 12px;
  line-height: 1.5;
  text-wrap: pretty;
}

.sb-bio {
  margin: 0 0 8px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.6;
  text-wrap: pretty;
}
.sb-bio:last-child { margin-bottom: 0; }

.sb-now {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sb-now li {
  display: grid;
  grid-template-columns: 80px 1fr;
  font-family: var(--mono);
  font-size: 12px;
  align-items: baseline;
}
.sb-now-label { color: var(--fg-faint); }
.sb-now-value { color: var(--fg); }

.sb-foot { margin-top: auto; padding-top: 20px; border-top: 1px dashed var(--line); }
.sb-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim);
}
.sb-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-soft); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ----- Stage / latent canvas -------------------------------------------- */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 12, 0.55);
  backdrop-filter: blur(8px);
  z-index: 3;
}
.stage-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
}

.latent-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}
.latent-wrap canvas {
  position: absolute;
  inset: 0;
  display: block;
}

.latent-axes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
  opacity: 0.6;
}
.latent-axes .ax-x {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
}
.latent-axes .ax-y {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: rotate(-90deg) translateX(50%);
  transform-origin: left top;
}

/* ----- Project list (bottom-left over canvas) --------------------------- */

.plist {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 280px;
  background: rgba(11, 13, 20, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px 10px;
  backdrop-filter: blur(10px);
  z-index: 2;
}
.plist .sb-tag { margin-bottom: 8px; }
.plist ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.plist li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  transition: background 0.15s, color 0.15s;
  min-width: 0;
}
.plist-name {
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.plist-kind {
  color: var(--fg-faint);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.plist li:hover, .plist li.active {
  background: rgba(140, 200, 255, 0.07);
  color: var(--fg);
}
.plist-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-soft);
}
.plist li.active .plist-dot {
  background: #fff;
  box-shadow: 0 0 12px var(--accent);
}

/* ----- Project panel (right slide-in) ----------------------------------- */

.panel-wrap {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 440px;
  max-width: 90vw;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: 20;
  pointer-events: none;
}
.panel-wrap.open { transform: translateX(0); pointer-events: auto; }

.panel {
  height: 100%;
  background: linear-gradient(180deg, #0d1019 0%, #08090f 100%);
  border-left: 1px solid var(--line-strong);
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.panel-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-faint);
}
.panel-name {
  margin: 6px 0 4px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #e6ebf5 0%, #b9c7e8 60%, #c5b3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.panel-kind {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}

.panel-close {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-dim);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.panel-close:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.panel-blurb {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
  margin: 0;
  text-wrap: pretty;
}

.panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-dim);
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}
.chip-sm { font-size: 10px; padding: 3px 7px; }

.sb-skills { display: flex; flex-direction: column; gap: 12px; }
.sb-skillgroup { display: flex; flex-direction: column; gap: 6px; }
.sb-skillgroup-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-faint);
  letter-spacing: 0.04em;
}
.sb-chips { display: flex; flex-wrap: wrap; gap: 4px; }

.ai-actions { display: flex; gap: 6px; }
.ai-btn.ghost { color: var(--fg-faint); border-color: var(--line); }
.ai-btn.ghost:hover { color: var(--fg); border-color: var(--line-strong); background: transparent; }

.caret {
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  animation: blink 1s infinite step-end;
}

.panel-ai {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: rgba(255,255,255,0.015);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.panel-ai::before {
  content: "";
  position: absolute;
  left: -1px; top: 14px;
  width: 2px; height: calc(100% - 28px);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  opacity: 0.5;
  border-radius: 2px;
}
.panel-ai-head {
  display: flex; justify-content: space-between; align-items: center;
}
.ai-btn {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.ai-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.ai-btn:disabled { opacity: 0.6; cursor: wait; }

.panel-ai-body {
  min-height: 56px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-dim);
}
.panel-ai-body p { margin: 0; color: var(--fg); text-wrap: pretty; }
.ai-hint { font-family: var(--mono); font-size: 11.5px; color: var(--fg-faint); }
.ai-err { font-family: var(--mono); font-size: 11.5px; color: #e88; }

.dots { display: inline-flex; gap: 4px; }
.dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: dot 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

.panel-link {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg);
  background: rgba(255,255,255,0.02);
  transition: all 0.2s;
}
.panel-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.panel-link .arrow { transition: transform 0.2s; }
.panel-link:hover .arrow { transform: translateX(4px); }

/* ----- Boot overlay ------------------------------------------------------ */

.boot {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.boot.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-inner {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-dim);
  min-width: 280px;
}
.boot-line { animation: bootIn 0.3s ease both; }
@keyframes bootIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}
.boot-cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1s infinite step-end;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* tablet */
@media (max-width: 1100px) {
  .app { grid-template-columns: 320px 1fr; }
  .plist { width: 260px; }
  .plist-kind { display: none; }
}

/* mobile */
@media (max-width: 900px) {
  body { overflow: auto; }
  html, body, #root { height: auto; min-height: 100%; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 100vh;
  }
  .sidebar {
    padding: 24px 20px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    gap: 22px;
    overflow-y: visible;
  }
  .sidebar::after {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: auto;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent,
      var(--accent-soft) 30%,
      var(--accent-soft) 70%,
      transparent
    );
  }
  .sb-name { font-size: 24px; }
  .stage {
    height: 70vh;
    min-height: 480px;
  }
  .stage-head { padding: 14px 18px; }
  .stage-hint { display: none; }
  .latent-axes { display: none; }
  .plist {
    position: relative;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    margin: 0 16px 16px;
    max-height: 180px;
    overflow-y: auto;
  }
  .panel-wrap { width: 100%; max-width: 100%; }
  .panel { padding: 22px 20px; }
  .panel-name { font-size: 24px; }
}

/* very small */
@media (max-width: 480px) {
  .sidebar { padding: 20px 16px; }
  .sb-name { font-size: 22px; }
  .sb-now li { grid-template-columns: 70px 1fr; font-size: 11px; }
  .stage-head { padding: 12px 14px; }
  .plist { margin: 0 12px 12px; padding: 12px; }
  .panel { padding: 18px 16px; }
  .panel-head { gap: 8px; }
  .panel-name { font-size: 22px; }
  .panel-blurb { font-size: 14px; }
}
