/* ============================================
   Personal Website — Dark Theme
   ============================================ */

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

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --border: #27272a;
  --radius: 8px;
  --max-width: 900px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

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

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 200;
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--bg-primary);
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 5rem 0;
}

section + section {
  border-top: 1px solid var(--border);
}

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

.nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.nav-logo {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 400;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 60px;
}

.hero-content {
  max-width: 600px;
}

.hero-greeting {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero h1 .highlight {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 500px;
}

.hero-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.hero-links a:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.hero-links svg {
  width: 18px;
  height: 18px;
}

/* --- Section headings --- */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

/* --- About --- */
.about-text {
  color: var(--text-secondary);
  max-width: 600px;
  font-size: 1.05rem;
}

.about-text p + p {
  margin-top: 1rem;
}

.about-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* --- Projects --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

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

.project-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.project-card h3 a {
  color: var(--text-primary);
}

.project-card h3 a:hover {
  color: var(--accent);
}

.project-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  flex-grow: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

/* --- Blog --- */
.blog-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.blog-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.blog-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.blog-item a {
  color: var(--text-primary);
  font-weight: 500;
}

.blog-item a:hover {
  color: var(--accent);
}

.blog-item time {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  margin-left: 1rem;
}

/* --- Contact --- */
.contact-text {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
  max-width: 500px;
}

.contact-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.contact-links a:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.contact-links svg {
  width: 18px;
  height: 18px;
}

/* --- Footer --- */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Blog Page Styles --- */
.page-header {
  padding-top: 120px;
  padding-bottom: 2rem;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.post-header {
  padding-top: 120px;
  padding-bottom: 1rem;
}

.post-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

.post-content {
  padding: 2rem 0 4rem;
  max-width: var(--max-width);
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.post-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.post-content p strong {
  color: var(--text-primary);
}

.post-content ul, .post-content ol {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-card);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--accent);
}

.post-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-main {
  padding-bottom: 4rem;
}

.post-nav {
  padding-bottom: 4rem;
}

.back-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.back-link:hover {
  color: var(--accent);
}

/* --- 404 --- */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-page h1 {
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.error-page p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin: 1rem 0 2rem;
}

.error-page a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.error-page a:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  section {
    padding: 3.5rem 0;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .blog-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  .blog-item time {
    margin-left: 0;
  }

  .hero-links {
    flex-wrap: wrap;
  }
}
