/* ── VARIABLES ── */
:root {
  --white: #ffffff;
  --off: #f5f5f3;
  --ink: #0d0d0c;
  --ink2: #2c2c2a;
  --muted: #8a8a84;
  --border: rgba(0,0,0,0.07);
  --border-hover: rgba(0,0,0,0.18);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 40px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 100px;
  --font-display: 'Instrument Serif', serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --tab-height: 80px;
  --input-height: 72px;
  --topbar-height: 56px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  cursor: none;
}
@media (pointer: coarse) { body { cursor: auto; } }
input, button, textarea { font-family: var(--font-body); }
a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

/* ── TOPBAR ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--topbar-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
.topbar-logo {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-style: italic; color: var(--ink);
}
.topbar-status {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 1.5vw, 0.68rem);
  color: var(--muted); letter-spacing: 0.08em;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; flex-shrink: 0;
}

/* ── MAIN LAYOUT ── */
.page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center;
  padding-top: calc(var(--topbar-height) + clamp(1.5rem, 4vw, 3rem));
  padding-bottom: calc(var(--tab-height) + var(--input-height) + 1rem);
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}

/* ── HERO ── */
.hero {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  width: 100%; max-width: 640px;
  gap: 0;
}
.hero-greeting {
  font-family: var(--font-mono);
  font-size: clamp(0.65rem, 1.8vw, 0.72rem);
  color: var(--muted); letter-spacing: 0.15em;
  text-transform: uppercase; margin-bottom: 1rem;
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-style: italic; line-height: 1;
  letter-spacing: -0.02em; color: var(--ink);
  margin-bottom: 0.4rem;
}
.hero-role {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0; margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}
.hero-role span {
  font-size: clamp(0.72rem, 2vw, 0.85rem);
  font-weight: 400; color: var(--muted);
  padding: 0 clamp(0.4rem, 1.5vw, 0.7rem);
  border-right: 1px solid var(--border);
}
.hero-role span:last-child { border-right: none; }

/* ── AVATAR ── */
.avatar-wrap {
  position: relative;
  width: clamp(90px, 15vw, 130px);
  height: clamp(90px, 15vw, 130px);
  margin: 0 auto clamp(1rem, 3vw, 1.5rem);
}
.avatar-ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.07);
}
.avatar-ring-2 {
  position: absolute; inset: -16px; border-radius: 50%;
  border: 1px dashed rgba(0,0,0,0.04);
}
.avatar-brain {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.avatar-brain svg { width: 55%; height: 55%; position: relative; z-index: 1; }
.nodes { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.node {
  position: absolute; width: 3px; height: 3px;
  border-radius: 50%; background: rgba(255,255,255,0.5);
}

/* ── CHAT BOX ── */
.chat-box {
  width: 100%; max-width: 600px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
}
.chat-messages {
  min-height: 80px;
  max-height: clamp(200px, 35vh, 340px);
  overflow-y: auto; margin-bottom: 1rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 0; }

/* Message bubbles */
.msg {
  display: flex; gap: 0.55rem; align-items: flex-end;
}
.msg.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.58rem; color: white;
  font-family: var(--font-mono); letter-spacing: 0;
  align-self: flex-end;
}
.msg-avatar.user-av { background: var(--off); color: var(--ink2); border: 1px solid var(--border); }
.msg-bubble {
  padding: 0.7rem 1rem;
  border-radius: 18px; font-size: clamp(0.8rem, 2.2vw, 0.88rem);
  line-height: 1.65; max-width: calc(100% - 42px);
  text-align: left;
}
.msg.ai .msg-bubble {
  background: var(--off); color: var(--ink);
  border-bottom-left-radius: 5px;
}
.msg.user .msg-bubble {
  background: var(--ink); color: white;
  border-bottom-right-radius: 5px;
}

/* Typing indicator */
.typing-wrap { display: flex; gap: 0.55rem; align-items: flex-end; }
.typing-bubble {
  padding: 0.7rem 1rem;
  background: var(--off); border-radius: 18px;
  border-bottom-left-radius: 5px;
  display: flex; gap: 5px; align-items: center;
}
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
}

/* Cards inside chat */
.chat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 35vw, 200px), 1fr));
  gap: 0.6rem; margin-top: 0.5rem;
}
.chat-card {
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius-md); padding: 0.9rem;
  transition: all 0.2s; cursor: pointer;
}
.chat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.chat-card-icon { font-size: 1.2rem; margin-bottom: 0.35rem; }
.chat-card-title { font-weight: 600; font-size: 0.8rem; color: var(--ink); margin-bottom: 0.2rem; }
.chat-card-sub { font-family: var(--font-mono); font-size: 0.62rem; color: var(--muted); }

/* Skill pills in chat */
.chat-skill-group { margin-top: 0.5rem; }
.chat-skill-group-title { font-weight: 600; font-size: 0.82rem; margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.4rem; }
.chat-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.75rem; }
.chat-pill {
  padding: 0.22rem 0.65rem;
  background: var(--ink); color: white;
  border-radius: var(--radius-pill);
  font-size: 0.72rem; font-family: var(--font-mono);
}

/* Cert rows in chat */
.chat-cert {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.6rem 0.8rem; background: white;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 0.5rem; transition: all 0.2s;
}
.chat-cert:hover { border-color: var(--border-hover); }
.chat-cert-name { font-weight: 500; font-size: 0.82rem; }
.chat-cert-issuer { font-size: 0.68rem; color: var(--muted); font-family: var(--font-mono); }

/* Contact links in chat */
.chat-contact-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.7rem 0.9rem; background: white;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 0.5rem; font-size: 0.82rem;
  transition: all 0.2s; color: var(--ink);
}
.chat-contact-link:hover { background: var(--ink); color: white; border-color: var(--ink); }

/* Chat input */
.chat-input-row { display: flex; gap: 0.6rem; align-items: center; }
.chat-input {
  flex: 1; padding: 0.72rem 1rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: clamp(0.82rem, 2.2vw, 0.88rem);
  background: var(--white); color: var(--ink);
  outline: none; transition: border-color 0.2s;
  cursor: text;
}
.chat-input:focus { border-color: rgba(0,0,0,0.22); }
.chat-input::placeholder { color: var(--muted); }
.chat-send {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  background: var(--ink); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.chat-send:hover { transform: scale(1.05); background: #2a2a28; }
.chat-send:disabled { opacity: 0.35; transform: none; }
.chat-send svg { width: 16px; height: 16px; fill: white; }

/* ── QUICK TABS ── */
.quick-tabs {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  justify-content: center; width: 100%; max-width: 600px;
}
.tab-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: clamp(0.45rem, 1.5vw, 0.55rem) clamp(0.8rem, 2.5vw, 1.1rem);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border: 1.5px solid var(--border); border-radius: var(--radius-pill);
  font-size: clamp(0.72rem, 2vw, 0.8rem);
  color: var(--ink2); transition: all 0.2s; white-space: nowrap;
}
.tab-btn:hover, .tab-btn.active {
  background: var(--ink); color: white; border-color: var(--ink);
  transform: translateY(-1px);
}
.tab-icon { font-size: 0.9rem; }

/* ── FOOTER ── */
.footer {
  text-align: center; padding: 0.75rem;
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--muted); letter-spacing: 0.08em;
  margin-top: 1rem;
}

/* ── RESPONSIVE ── */

/* Tablet */
@media (min-width: 600px) {
  .chat-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Laptop */
@media (min-width: 1024px) {
  .chat-box { max-width: 680px; }
  .hero { max-width: 720px; }
  .chat-cards { grid-template-columns: repeat(3, 1fr); }
}

/* Large desktop */
@media (min-width: 1440px) {
  body { font-size: 16px; }
  .chat-box { max-width: 760px; }
  .hero { max-width: 820px; }
}

/* TV / 4K */
@media (min-width: 2000px) {
  :root { --topbar-height: 72px; }
  body { font-size: 18px; }
  .chat-box { max-width: 900px; }
  .hero { max-width: 1000px; }
  .hero-name { font-size: 7rem; }
}

/* Touch devices — hide cursor */
@media (pointer: coarse) {
  .cursor, .cursor-ring { display: none !important; }
}
