/* ============================================================
   RK Portfolio — Mono Design System
   One source of truth for color, type, spacing and components.
   ============================================================ */

:root {
  /* Palette — pure grayscale */
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --ink: #0a0a0a;
  --ink-2: #262626;
  --ink-3: #404040;
  --muted: #737373;
  --muted-2: #a3a3a3;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --accent: #0a0a0a;
  --accent-hover: #262626;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Shadows — extremely subtle */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px -8px rgba(0,0,0,0.12);

  /* Layout */
  --nav-h: 64px;
  --container: 1100px;
  --container-wide: 1240px;
}

/* ===================== Reset & base ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  scroll-behavior: smooth;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }

input, textarea { font-family: inherit; font-size: inherit; color: inherit; }

::selection { background: var(--ink); color: #fff; }

/* ===================== Typography ===================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.h-display { font-size: clamp(2.25rem, 4vw, 3.25rem); font-weight: 800; letter-spacing: -0.03em; }
.h-1 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
.h-2 { font-size: 1.375rem; }
.h-3 { font-size: 1.125rem; }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }

/* ===================== Layout helpers ===================== */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: var(--container-wide); margin: 0 auto; padding: 0 24px; }

.section { padding: 56px 0; }
.section-sm { padding: 36px 0; }
.divider { height: 1px; background: var(--border); border: 0; }

/* ===================== Nav ===================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: saturate(1.3) blur(8px);
  -webkit-backdrop-filter: saturate(1.3) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  height: 100%;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links a {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: color .15s ease, background .15s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

@media (max-width: 860px) {
  .nav-links { display: none; }
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: all .15s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 22px; font-size: 14px; border-radius: var(--r-md); }

/* ===================== Mode toggle (Static / Agentic) ===================== */
.mode-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.mode-toggle button {
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s ease;
  line-height: 1;
}
.mode-toggle button:hover { color: var(--ink); }
.mode-toggle button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.mode-toggle button svg { width: 12px; height: 12px; }

body.mode-static .agentic-only { display: none !important; }
body.mode-agentic .static-only { display: none !important; }

/* ===================== Cards ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.card-interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card-body { padding: 20px; }
.card-body-lg { padding: 28px; }

/* ===================== Pills / Tags ===================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill-dark {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.pill-outline {
  background: transparent;
  border-color: var(--border-strong);
}

/* ===================== Timeline ===================== */
.timeline { list-style: none; padding-left: 0; }
.timeline li {
  position: relative;
  padding-left: 22px;
  padding-bottom: 24px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--ink);
}
.timeline-role { font-size: 15px; font-weight: 700; color: var(--ink); }
.timeline-meta { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.timeline-desc { font-size: 13px; color: var(--ink-3); }
.timeline-desc + .timeline-desc { margin-top: 4px; }

/* ===================== Skills cloud ===================== */
.skills { display: flex; flex-wrap: wrap; gap: 8px; }
.skill {
  font-size: 12.5px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--ink-3);
  transition: all .15s ease;
}
.skill:hover { border-color: var(--ink); color: var(--ink); }

/* ===================== Prototype card ===================== */
.proto-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
}
.proto-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.proto-thumb {
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.proto-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
  filter: grayscale(0.15);
}
.proto-card:hover .proto-thumb img { transform: scale(1.03); filter: grayscale(0); }
.proto-body { padding: 16px 18px 18px; }
.proto-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.proto-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.proto-desc { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* ===================== Static-mode prototype strip (compact list) ===================== */
.proto-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all .15s ease;
}
.proto-strip:hover { border-color: var(--ink); transform: translateX(2px); }
.proto-strip .mini {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
}
.proto-strip .mini img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.2); }
.proto-strip-text { flex: 1; min-width: 0; }
.proto-strip-text .t { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.proto-strip-text .s { font-size: 12px; color: var(--muted); }
.proto-strip .arrow { color: var(--muted-2); transition: transform .15s ease, color .15s ease; }
.proto-strip:hover .arrow { color: var(--ink); transform: translateX(2px); }

/* ===================== Chat interface ===================== */
.chat-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: min(720px, calc(100vh - var(--nav-h) - 200px));
  min-height: 520px;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  letter-spacing: 0.01em;
}
.chat-header-text { flex: 1; min-width: 0; }
.chat-title { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.chat-subtitle { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; line-height: 1.2; margin-top: 2px; }
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}
.chat-clear {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: all .15s ease;
}
.chat-clear:hover { background: var(--surface-2); color: var(--ink); }

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
  scroll-behavior: smooth;
}
.chat-stream::-webkit-scrollbar { width: 8px; }
.chat-stream::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.chat-stream::-webkit-scrollbar-track { background: transparent; }

.msg { display: flex; gap: 10px; max-width: 92%; animation: msgIn .25s ease-out; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.msg.user .msg-avatar { background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); }

.bubble {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  word-wrap: break-word;
}
.msg.user .bubble {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.bubble strong { color: var(--ink); font-weight: 700; }
.msg.user .bubble strong { color: #fff; }
.bubble p + p { margin-top: 8px; }
.bubble ul { padding-left: 18px; margin-top: 6px; }
.bubble ul li { margin-bottom: 4px; }
.bubble a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.bubble a:hover { text-decoration-thickness: 2px; }

.bubble-card {
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  transition: all .15s ease;
}
.bubble-card:hover { border-color: var(--ink); background: var(--surface); }
.bubble-card .t { font-size: 13px; font-weight: 700; color: var(--ink); }
.bubble-card .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.bubble-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
@media (max-width: 540px) { .bubble-grid { grid-template-columns: 1fr; } }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.suggestion {
  font-size: 12px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-weight: 500;
  transition: all .15s ease;
  line-height: 1;
}
.suggestion:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.suggestion.disabled { opacity: 0.4; pointer-events: none; }

.chat-input-bar {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-input {
  flex: 1;
  padding: 9px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.chat-input:focus { border-color: var(--ink); background: var(--surface); }
.chat-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.chat-send:hover { background: var(--ink-2); }
.chat-send:disabled { background: var(--border-strong); cursor: not-allowed; }

.chat-prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}
@media (max-width: 540px) { .chat-prompt-grid { grid-template-columns: 1fr; } }
.chat-prompt-tile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
  width: 100%;
}
.chat-prompt-tile:hover { border-color: var(--ink); background: var(--surface); transform: translateY(-1px); }
.chat-prompt-tile .icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--ink);
}
.chat-prompt-tile .text-block { flex: 1; min-width: 0; }
.chat-prompt-tile .label { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.chat-prompt-tile .hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.3; }

.typing {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
}
.typing span {
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.2; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ===================== Hero ===================== */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 48px;
  align-items: center;
  padding: 64px 0 32px;
}
.hero-portrait {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-left: auto;
}
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.1); }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 32px 0 16px; text-align: center; }
  .hero-portrait { margin: 0 auto; width: 160px; height: 160px; }
}

/* ===================== Articles ===================== */
.article {
  display: block;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.article:last-child { border-bottom: none; }
.article-title { font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.article-meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 10px; }
.article:hover .article-title { text-decoration: underline; text-underline-offset: 4px; }

/* ===================== Footer ===================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 64px;
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-text { font-size: 12px; color: var(--muted); }
.footer-socials { display: flex; gap: 16px; }
.footer-socials a {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  border-radius: var(--r-sm);
  transition: all .15s ease;
}
.footer-socials a:hover { color: var(--ink); background: var(--surface-2); }

/* ===================== Floating back chip (used in prototype pages) ===================== */
.back-chip {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-md);
  transition: transform .15s ease, background .15s ease;
}
.back-chip:hover { transform: translateX(-2px); background: var(--ink-2); }
.back-chip svg { width: 12px; height: 12px; }

/* ===================== Utility ===================== */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
