@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;700&display=swap');

:root {
  /* Color Palette - Deep Space Theme */
  --bg-color: #0B0E14;
  /* Darker, richer background */
  --bg-gradient: radial-gradient(circle at 50% 0%, #1c2333 0%, #0B0E14 70%);
  --surface-color: rgba(22, 27, 34, 0.7);
  /* Glass-like */

  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --accent-primary: #6366F1;
  /* Indigo */
  --accent-secondary: #EC4899;
  /* Pink/Rose */
  --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));

  --border-color: rgba(255, 255, 255, 0.1);

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --container-max: 1200px;
  /* Wider container */
  --header-height: 90px;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;

  /* Effects */
  --glass-blur: blur(12px);
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.3);
}


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

body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

/* Layout */
.base__container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--space-md);
}

/* Header */
.header {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

.title h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.second_name {
  color: var(--text-muted);
  font-weight: 400;
}

/* Navigation */
.nav__lists {
  display: flex;
  gap: var(--space-md);
  list-style: none;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 1.5rem;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
}

.nav__item a {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.nav__item a:hover {
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Main Content Wrapper */
.main__container {
  flex: 1;
  display: flex;
  flex-direction: column;
  /* justify-content: center; Removed to prevent layout shift */
  padding: var(--space-lg) 0;
}

/* Typography Helpers */
h1,
h2,
h3 {
  font-family: var(--font-heading);
  line-height: 1.2;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Hero Section (Home) */
.hero {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero__title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.hero__subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-weight: 300;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  padding: 0.8rem 2rem;
  border-radius: 100px;
  font-weight: 600;
  font-family: var(--font-heading);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

/* About Page (Refactored) */
.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: center;
}

@media (max-width: 768px) {
  .about__grid {
    grid-template-columns: 1fr;
  }
}

.about__image-wrapper {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.about__image {
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.about__image-wrapper:hover .about__image {
  transform: scale(1.03);
}

.about__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.about__bio {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.about__work-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.about__work-item {
  position: relative;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.about__work-item::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent-primary);
}

.about__link {
  color: var(--accent-primary);
  border-bottom: 1px solid transparent;
}

.about__link:hover {
  border-color: var(--accent-primary);
}

/* Work Grid (Refactored) */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-primary);
  background: rgba(22, 27, 34, 0.9);
}

.project-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

.project-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
  /* Pushes tags to bottom */
}

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

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
  border-radius: 100px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Footer / Socials */
.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-lg);
  padding: 1.5rem 3rem;

  /* Glassmorphism Container */
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  /* Pill shape container */
  list-style: none;
  width: fit-content;
  max-width: 90%;
  /* Prevent overflow on small screens */
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap;
  /* Allow wrapping on very small screens */
  justify-content: center;
  /* Ensure contents stay centered */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.social-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 100px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: inline-block;
}

.social-link:hover {
  color: #fff;
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Blog List Styles */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  /* Matched to work-grid for consistency */
  gap: 2rem;
  /* margin-top removed to reduce gap */
}

.blog-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.blog-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-5px);
  background: rgba(22, 27, 34, 0.9);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

/* Ensure blog titles wrap */
.blog-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: any-where;
  /* FORCE break anywhere if needed */
  word-break: break-word;
  hyphens: auto;
}

.blog-snippet {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.blog-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: auto;
}

.read-more {
  color: var(--accent-primary);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.read-more:hover {
  gap: 0.5rem;
}

/* Article Content Styles */
.article-container {
  max-width: 800px;
  margin: 0 auto;
}

.article-header {
  text-align: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.article-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  line-height: 1.2;
  overflow-wrap: anywhere;
  /* Use standard syntax 'anywhere' specifically */
  word-break: break-word;
  padding: 0 1rem;
  /* Add padding to prevent edge touching */
}

.article-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 65ch;
  /* Optimal reading measure */
  margin-left: auto;
  margin-right: auto;
}

.article-content h2 {
  color: var(--text-primary);
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.article-content h3 {
  color: var(--text-primary);
  font-size: 1.4rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

/* Article Paper / Light Theme */
.article-paper {
  background: #ffffff;
  color: #1e293b;
  /* Slate 800 */
  padding: 2rem 3rem 4rem;
  /* Adjusted top padding */
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  max-width: 800px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .article-paper {
    padding: 1.5rem 1rem;
    /* border-radius: 0; REMOVED to keep rounded corners */
    /* width: calc(100% + 2rem); REMOVED to keep margin */
    /* margin: 0 -1rem; REMOVED */
    margin: 0 -0.5rem;
    /* Slight negative margin to pull closer but not touch */
    width: calc(100% + 1rem);
    border-radius: 8px;
    /* Slightly smaller radius */
  }

  /* Prevent horizontal scroll if negative margin pushes too far */
  body {
    overflow-x: hidden;
  }
}

.article-content {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #334155;
  /* Slate 700 - Darker for light bg */
  max-width: 65ch;
  /* Optimal reading measure */
  margin-left: auto;
  margin-right: auto;
}

.article-content h2 {
  color: #0f172a;
  /* Slate 900 - Almost black */
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
}

.article-content h3 {
  color: #0f172a;
  /* Slate 900 */
  font-size: 1.4rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  /* Ensure lists track with the max-width content if necessary, though they are inside .article-content so they should be fine. */
}

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

.article-content code {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  background: #f1f5f9;
  /* Slate 100 */
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: #0f172a;
  /* Slate 900 */
  border: 1px solid #e2e8f0;
}

.article-content pre {
  background: #1e293b;
  /* Keep code blocks dark for contrast */
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 100%;
  /* Force code block to respect container width */
  margin-bottom: 2rem;
  border: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  white-space: pre-wrap;
  /* ALTERNATIVE: Force code to wrap instead of scroll */
  word-break: break-all;
  /* Break long strings like base64 */
}

.article-content pre code {
  background: none;
  border: none;
  color: #e2e8f0;
  /* Light text for dark code block */
  font-size: 0.95rem;
}

.article-content blockquote {
  border-left: 4px solid var(--accent-primary);
  padding-left: 1.5rem;
  font-style: italic;
  color: var(--text-muted);
  margin: 2rem 0;
}

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

.back-link:hover {
  color: var(--accent-primary);
  transform: translateX(-5px);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
  object-fit: contain;
}

.lightbox.active img {
  transform: scale(1);
}

/* Make article images zoomable */
.article-content img {
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.article-content img:hover {
  transform: scale(1.02);
}

@media (max-width: 768px) {
  .article-paper {
    padding: 1.5rem 1rem;
    /* border-radius: 0; REMOVED to keep rounded corners */
    /* width: calc(100% + 2rem); REMOVED to keep margin */
    /* margin: 0 -1rem; REMOVED */
    margin: 0 -0.5rem;
    /* Slight negative margin to pull closer but not touch */
    width: calc(100% + 1rem);
    border-radius: 8px;
    /* Slightly smaller radius */
  }

  /* Prevent horizontal scroll if negative margin pushes too far */
  body {
    overflow-x: hidden;
  }
}

@media (max-width: 768px) {
  :root {
    --space-md: 1rem;
    /* Reduce side padding on mobile */
    --space-lg: 2rem;
    --space-xl: 4rem;
  }

  .social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-lg);
    padding: 1rem 1.5rem;

    /* Glassmorphism Container */
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    /* Pill shape container */
    list-style: none;
    width: fit-content;
    max-width: 90%;
    /* Prevent overflow on small screens */
    margin-left: auto;
    margin-right: auto;
    flex-wrap: wrap;
    /* Allow wrapping on very small screens */
    justify-content: center;
    /* Ensure contents stay centered */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  }
}