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

/* Variables */
:root {
  --bg-dark: #0d1117;
  --bg-sidebar: #161b22;
  --bg-content: #0d1117;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-glow: rgba(88, 166, 255, 0.4);
  --border: #30363d;
  --code-bg: #1c2128;

  --sidebar-width: 260px;
  --content-max: 900px;
  --spacing: 1.5rem;
  --transition: 0.2s ease;
}

/* Base */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: var(--spacing);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  margin-bottom: 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition), text-shadow var(--transition);
}

.logo:hover {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.tagline {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.nav-links {
  list-style: none;
  flex: 1;
}

.nav-links li {
  margin-bottom: 0.5rem;
}

.nav-links a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all var(--transition);
}

.nav-links a:hover {
  background: var(--border);
  color: var(--text-primary);
  border-left-color: var(--accent);
  padding-left: calc(0.75rem + 4px);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: var(--spacing);
  display: flex;
  gap: 1rem;
}

.sidebar-footer a {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition), text-shadow var(--transition);
}

.sidebar-footer a:hover {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

/* Content */
.content {
  padding: 3rem;
  max-width: calc(var(--content-max) + 6rem);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  transition: border-color var(--transition);
}

h2:hover {
  border-bottom-color: var(--accent);
}

h3 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

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

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

/* Animated underline for content links */
.content a:not(.no-underline) {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size var(--transition), color var(--transition);
}

.content a:not(.no-underline):hover {
  background-size: 100% 1px;
}

/* Lists */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* Code */
code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

pre:hover {
  border-left-color: var(--accent-hover);
  box-shadow: 0 0 20px rgba(88, 166, 255, 0.1);
}

pre code {
  background: none;
  padding: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

th, td {
  text-align: left;
  padding: 0.75rem;
  border: 1px solid var(--border);
  transition: background var(--transition);
}

th {
  background: var(--bg-sidebar);
  font-weight: 600;
}

tr:nth-child(even) {
  background: var(--code-bg);
}

tr:hover td {
  background: rgba(88, 166, 255, 0.05);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Blockquote */
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin: 1rem 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

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

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-header {
    margin-bottom: 1rem;
  }

  .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-links li {
    margin-bottom: 0;
  }

  .sidebar-footer {
    margin-top: 1rem;
  }

  .content {
    padding: 1.5rem;
  }
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

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

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

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth image hover */
img {
  transition: transform var(--transition), box-shadow var(--transition);
}

img:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 50%, var(--text-primary) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.hero-location {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Featured Card */
.featured-card {
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--code-bg) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.featured-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(88, 166, 255, 0.15);
  border-left-color: var(--accent-hover);
}

.featured-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.featured-card h3 a {
  font-size: 1.5rem;
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

/* Project Cards */
.project-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  border-color: var(--accent);
}

.project-card.highlight {
  border-left: 3px solid var(--accent);
}

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

.project-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.project-card p:last-child {
  margin-bottom: 0;
}

/* Card Tech Tag */
.card-tech {
  font-size: 0.75rem !important;
  color: var(--accent) !important;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Card Link */
.card-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* View All Link */
.view-all {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.view-all:hover {
  color: var(--accent);
}

/* About Page - Lead Text */
.about-intro {
  text-align: center;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  transition: transform var(--transition), border-color var(--transition);
}

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

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Tech Tags */
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tech-tag {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.tech-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(88, 166, 255, 0.1);
}

/* Contact Links */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  transition: all var(--transition);
}

.contact-link:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.05);
  transform: translateX(4px);
}

.contact-icon {
  color: var(--accent);
  font-weight: bold;
}

/* Project card h4 */
.project-card h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--text-primary);
}

/* Site Footer */
.site-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.footer-content {
  text-align: center;
}

.footer-tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-style: italic;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}

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

.footer-separator {
  color: var(--border);
}

.footer-crab {
  font-size: 1.5rem;
  margin: 0;
  opacity: 0.6;
  transition: all var(--transition);
  cursor: default;
}

.footer-crab:hover {
  opacity: 1;
  transform: scale(1.2) rotate(10deg);
}
