:root {
  --primary: #0f172a;
  --primary-light: #1e293b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.08);
  --accent-subtle: rgba(59, 130, 246, 0.04);
  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-border: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --max-width: 1120px;
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

h1 { font-size: 2.5rem; letter-spacing: -0.03em; }
h2 { font-size: 2rem; letter-spacing: -0.02em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p { margin: 0 0 1.25rem; }
p:last-child { margin-bottom: 0; }

ul { padding: 0; margin: 0; list-style: none; }

::selection {
  background: var(--accent);
  color: white;
}

/* Layout */
.site-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  height: var(--nav-height);
}

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

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

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

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

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-light);
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-cta {
  background: var(--primary);
  color: white !important;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background 0.2s ease;
}

.nav-cta:hover {
  background: var(--accent) !important;
  color: white !important;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text);
}

.hamburger svg {
  width: 22px;
  height: 22px;
}

/* Main content */
.main {
  flex: 1;
}

/* Section layout */
.section {
  padding: 80px 0;
}

.section-alt {
  padding: 80px 0;
  background: var(--surface);
}

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

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 48px;
}

/* Hero */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  background: linear-gradient(180deg, var(--accent-subtle) 0%, transparent 100%);
}

.hero-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero-image-wrapper {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
}

.hero-image {
  border-radius: 50%;
  width: 120px;
  height: 120px;
  object-fit: cover;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  color: var(--primary);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 32px;
}

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

/* Buttons */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.about-card {
  background: var(--bg);
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.about-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.about-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--primary);
}

.about-card p {
  font-size: 0.9375rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* Skills */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
}

.skill-badge {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.skill-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Projects grid (homepage) */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.project-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--bg);
  color: inherit;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.project-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 500 / 280;
  overflow: hidden;
  background: var(--surface);
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.project-info {
  padding: 18px 20px;
}

.project-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

/* Contact section */
.contact {
  padding: 100px 0;
}

.contact-card {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  background: var(--primary);
  padding: 56px 40px;
  border-radius: var(--radius-lg);
  color: white;
}

.contact-card h2 {
  color: white;
}

.contact-text {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 32px;
  line-height: 1.7;
}

.btn-contact {
  background: white;
  color: var(--primary);
}

.btn-contact:hover {
  background: var(--accent) !important;
  color: white !important;
}

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

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.footer-text {
  color: var(--text-light);
  font-size: 0.875rem;
}

.footer-link {
  color: var(--accent);
  font-weight: 500;
}

/* Post / Project detail page */
.post-page {
  padding: 56px 0 80px;
}

.post-header {
  text-align: center;
  margin-bottom: 40px;
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 24px;
}

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

.post-image {
  width: 100%;
  max-width: 700px;
  height: auto;
  border-radius: var(--radius);
  margin: 0 auto 32px;
  box-shadow: var(--shadow-md);
}

.post-content {
  max-width: 700px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content strong {
  font-weight: 600;
}

.post-content a {
  color: var(--accent);
  font-weight: 500;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content h5 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 24px;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 24px 0;
  box-shadow: var(--shadow);
}

/* Scroll to top */
.scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 50;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  height: 42px;
  width: 42px;
  padding: 9px;
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
  display: none;
  align-items: center;
  justify-content: center;
}

.scroll-top-btn.visible {
  display: flex;
}

.scroll-top-btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.scroll-top-btn svg {
  width: 18px;
  height: 18px;
}

/* Responsive */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
    box-shadow: var(--shadow-md);
  }

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

  .hamburger {
    display: block;
  }
}

@media (max-width: 640px) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  .section, .section-alt { padding: 56px 0; }
  .section-subtitle { margin-bottom: 32px; }
  .section-container { padding: 0 16px; }
  .hero { padding: 64px 0 56px; }
  .hero-title { font-size: 2.25rem; }
  .hero-subtitle { font-size: 1.05rem; }
  .hero-description { font-size: 1rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .contact { padding: 64px 0; }
  .contact-card { padding: 40px 24px; }
  .post-page { padding: 32px 0 56px; }
  .nav-inner { padding: 0 16px; }
}
