/* ============================================
   Claude Code Inspired Design System
   ============================================ */

:root {
  /* Background */
  --bg-primary: #141413;
  --bg-secondary: #1a1a18;
  --bg-tertiary: #1f1f1c;

  /* Border */
  --border-default: #2a2a26;
  --border-hover: #3a3a34;

  /* Text */
  --text-primary: #faf9f5;
  --text-secondary: #a1a09a;
  --text-muted: #6b6a64;

  /* Accent */
  --accent: #d97757;
  --accent-hover: #e08a6e;
  --accent-muted: rgba(217, 119, 87, 0.12);
  --accent-glow: rgba(217, 119, 87, 0.25);

  /* Accent Blue */
  --accent-blue: #6a9bcc;
  --accent-blue-muted: rgba(106, 155, 204, 0.12);

  /* Typography */
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --content-max: 900px;
  --nav-height: 56px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Selection */
::selection {
  background: var(--accent-muted);
  color: var(--accent);
}

/* ============================================
   Navigation
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(20, 20, 19, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
}

.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link-primary {
  color: var(--bg-primary);
  background: var(--accent);
  font-weight: 600;
}

.nav-link-primary:hover {
  color: var(--bg-primary);
  background: var(--accent-hover);
}

.nav-link-icon {
  padding: 6px 8px;
  color: var(--text-secondary);
}

.nav-link-icon:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link-external svg {
  opacity: 0.5;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform var(--transition-normal);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 5px);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -5px);
}

/* ============================================
   Hero
   ============================================ */

.hero {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 100px 24px 48px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid rgba(217, 119, 87, 0.2);
  margin-bottom: 28px;
  letter-spacing: 0.3px;
}

.hero-name {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.hero-tagline {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 16px;
  line-height: 1.65;
  min-height: 3.3em;
}

.hero-tagline-cursor {
  color: var(--accent);
  font-weight: 400;
  animation: blink 1s step-end infinite;
}

.hero-bio {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.hero .text-accent {
  color: var(--accent);
  font-weight: 500;
}

/* Chat area */
.chat {
  max-width: 740px;
  width: 100%;
  margin: 0 auto 40px;
  text-align: left;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  overflow: hidden;
}

.chat:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.chat-messages {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 0;
  overflow-y: auto;
}

.chat-messages.has-content {
  display: flex;
  max-height: calc(6 * 1.6em + 12px * 5 + 16px);
}

/* Scrollbar — Claude Code style */
.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

.chat-messages:not(.has-content) {
  display: none;
}

/* Individual message bubbles */
.chat-msg {
  display: flex;
  gap: 8px;
  line-height: 1.6;
  animation: fadeIn 0.2s ease;
}

.chat-msg-prefix {
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
}

.chat-msg-content {
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.chat-msg-user .chat-msg-content {
  color: var(--text-primary);
}

/* Streaming cursor */
.chat-msg-streaming .chat-msg-content::after {
  content: '|';
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

/* Loading dots */
.chat-loading {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.chat-loading span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: loadingDot 1.4s ease-in-out infinite;
}

.chat-loading span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDot {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Input row */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border-top: 1px solid transparent;
}

.chat-messages.has-content + .chat-input-row {
  border-top-color: var(--border-default);
}

.chat-prompt-icon {
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
  user-select: none;
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 0;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chat-send:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

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

.hero-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.hero-link:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
}

.hero-link svg {
  flex-shrink: 0;
}

.hero-link-primary {
  color: var(--bg-primary);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.hero-link-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg-primary);
}

/* ============================================
   Blog Page
   ============================================ */

.blog-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 120px 24px 80px;
}

.blog-page-header {
  margin-bottom: 40px;
}

.blog-page-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.blog-page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.blog-page-count {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================
   Pagination
   ============================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.pagination-link:hover:not([disabled]) {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--border-default);
}

.pagination-link.active {
  color: var(--accent);
  background: var(--accent-muted);
  border-color: rgba(217, 119, 87, 0.2);
  pointer-events: none;
}

.pagination-link[disabled] {
  color: var(--text-muted);
  opacity: 0.4;
  pointer-events: none;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .blog-page {
    padding: 100px 20px 60px;
  }

  .blog-page-title {
    font-size: 26px;
  }

  .pagination-link {
    min-width: 32px;
    height: 32px;
    font-size: 13px;
  }
}

/* ============================================
   Sections
   ============================================ */

.section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 48px 24px;
}

.section-header {
  margin-bottom: 40px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-muted);
}

/* ============================================
   Blog Cards
   ============================================ */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  aspect-ratio: 1;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.blog-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  opacity: 0;
  transition: opacity var(--transition-normal);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 0 20px var(--accent-glow);
  pointer-events: none;
}

.blog-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
}

.blog-card:hover::before {
  opacity: 1;
}

.blog-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.blog-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  letter-spacing: -0.3px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-source {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-blue);
  background: var(--accent-blue-muted);
  border: 1px solid rgba(106, 155, 204, 0.2);
  white-space: nowrap;
}

.blog-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.blog-card-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.blog-card-tag {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-default);
}

.blog-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ============================================
   Resume
   ============================================ */

.resume-block {
  margin-bottom: 48px;
}

.resume-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

.resume-heading svg {
  color: var(--accent);
}

.resume-card {
  display: flex;
  gap: 32px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-default);
}

.resume-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.resume-card-left {
  flex-shrink: 0;
  width: 140px;
}

.resume-period {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.resume-card-right {
  flex: 1;
  min-width: 0;
}

.resume-card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.resume-card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.resume-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 12px;
}

.resume-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.resume-tag {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid rgba(217, 119, 87, 0.15);
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.skill-category {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
}

.skill-category h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.skill-category p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  border-top: 1px solid var(--border-default);
  margin-top: 40px;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px 24px;
  text-align: center;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   Scroll Animation
   ============================================ */

.animate-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.blog-card:nth-child(1) { transition-delay: 0ms; }
.blog-card:nth-child(2) { transition-delay: 50ms; }
.blog-card:nth-child(3) { transition-delay: 100ms; }
.blog-card:nth-child(4) { transition-delay: 150ms; }
.blog-card:nth-child(5) { transition-delay: 200ms; }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 640px) {
  .hero {
    padding: 80px 20px 36px;
  }

  .hero-name {
    font-size: 34px;
    letter-spacing: -1px;
  }

  .hero-tagline {
    font-size: 16px;
  }

  .hero-bio {
    font-size: 14px;
  }

  .chat {
    margin-bottom: 32px;
  }

  .chat-input {
    font-size: 13px;
  }

  .section {
    padding: 36px 20px;
  }

  .section-title {
    font-size: 24px;
  }

  /* Mobile nav */
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(20, 20, 19, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-default);
    padding: 12px 20px;
    gap: 2px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-normal);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link {
    padding: 10px 14px;
    font-size: 15px;
  }

  /* Blog */
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .blog-card {
    aspect-ratio: auto;
    padding: 16px 18px;
  }

  .blog-card-header {
    flex-direction: column;
    gap: 8px;
  }

  /* Resume */
  .resume-card {
    flex-direction: column;
    gap: 8px;
  }

  .resume-card-left {
    width: auto;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

}
