/* Apple-inspired design system with advanced dark/light themes */

/* Light theme (default) */
:root,
:root[data-theme="light"] {
  /* Primary colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #fbfbfd;
  
  /* Text colors */
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #515154;
  
  /* Interactive colors */
  --link-color: #0066cc;
  --link-hover: #0077ed;
  --accent-color: #007aff;
  
  /* Borders and dividers */
  --border-light: #d2d2d7;
  --border-medium: #a1a1a6;
  --separator: #e5e5e7;
  
  /* Cards and surfaces */
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.04);
  --card-shadow: rgba(0, 0, 0, 0.04);
  --card-hover-shadow: rgba(0, 0, 0, 0.08);
  
  /* Code blocks */
  --code-bg: #f6f8fa;
  --code-border: #e1e4e8;
  --code-text: #24292e;
  
  /* Selection */
  --selection-bg: rgba(0, 122, 255, 0.15);
}

/* Dark theme */
:root[data-theme="dark"] {
  /* Primary colors */
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  
  /* Text colors */
  --text-primary: #f5f5f7;
  --text-secondary: #86868b;
  --text-tertiary: #a1a1a6;
  
  /* Interactive colors */
  --link-color: #2997ff;
  --link-hover: #409cff;
  --accent-color: #007aff;
  
  /* Borders and dividers */
  --border-light: #38383a;
  --border-medium: #48484a;
  --separator: #38383a;
  
  /* Cards and surfaces */
  --card-bg: #1c1c1e;
  --card-border: rgba(255, 255, 255, 0.04);
  --card-shadow: rgba(0, 0, 0, 0.3);
  --card-hover-shadow: rgba(0, 0, 0, 0.5);
  
  /* Code blocks */
  --code-bg: #161618;
  --code-border: #2c2c2e;
  --code-text: #f5f5f7;
  
  /* Selection */
  --selection-bg: rgba(41, 151, 255, 0.25);
}

/* Base reset and typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 17px;
  line-height: 1.47059;
  background: var(--bg-primary);
  color: var(--text-primary);
  scroll-behavior: smooth;
}

body {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Selection styling */
::selection {
  background: var(--selection-bg);
}

::-moz-selection {
  background: var(--selection-bg);
}

/* Apple-style navigation */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
  transition: all 0.3s ease;
}

[data-theme="dark"] header {
  background: rgba(0, 0, 0, 0.72);
}

.wrapper {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 22px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.site-name {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.022em;
  transition: opacity 0.2s ease;
}

.site-name:hover {
  opacity: 0.8;
}

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

nav ul {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
}

nav a {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
  padding: 8px 12px;
  border-radius: 18px;
  transition: all 0.2s ease;
}

nav a:hover,
nav a.selected {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  color: var(--text-primary);
  margin-left: 16px;
}

.theme-toggle:hover {
  background: var(--border-light);
  transform: scale(1.05);
}

/* Main content */
main {
  max-width: 70%;
  margin: 0 auto;
  padding: 0 22px;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 80px 0 60px;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero h1 {
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.07143;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  text-transform: uppercase;
}

.hero .description {
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.011em;
  line-height: 1.38095;
  color: var(--text-tertiary);
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero a,
.hero a:link,
.hero a:visited,
.hero a:hover,
.hero a:active {
  color: white !important;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.hero a:hover {
  opacity: 0.8;
}

/* Section styling */
.section,
.recent-posts {
  padding: 80px 0;
}

.section h2,
.recent-posts h2 {
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.003em;
  line-height: 1.08349;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 60px;
}

/* Card grid */
.item-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 32px;
  margin-top: 48px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 32px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px var(--card-shadow);
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px var(--card-hover-shadow);
  border-color: var(--border-medium);
}

.card-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.009em;
  line-height: 1.16667;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-meta {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.card-subtitle {
  font-size: 12px;
  font-weight: 200;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.card-summary {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.011em;
  line-height: 1.47059;
  color: var(--text-tertiary);
}

.view-all-card {
  background: linear-gradient(135deg, var(--accent-color), var(--link-color));
  border-color: transparent;
  color: white;
}

.view-all-card .card-title,
.view-all-card .card-subtitle,
.view-all-card .card-summary {
  color: white;
}

.view-all-card:hover {
  transform: translateY(-4px) scale(1.02);
  background: linear-gradient(135deg, var(--link-hover), var(--accent-color));
}

/* Unpublished post styling */
.unpublished-post {
  opacity: 0.7;
  border: 2px dashed var(--border-medium) !important;
  background: var(--bg-tertiary) !important;
}

.unpublished-post:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.unpublished-post .card-title::after {
  content: " 📝";
  font-size: 0.8em;
}

/* Draft notice styling */
.draft-notice {
  animation: fadeIn 0.3s ease-in;
}

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

/* Project-specific styling */
.content a[href*="simran.app"] {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-color), var(--link-color));
  color: white !important;
  text-decoration: none !important;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  margin: 16px 0;
  transition: all 0.2s ease;
  border: none !important;
}

.content a[href*="simran.app"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.3);
  background: linear-gradient(135deg, var(--link-hover), var(--accent-color));
  color: white !important;
}

/* Projects section enhancements */
.projects .card {
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-tertiary) 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}

.projects .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent-color), var(--link-color));
  border-radius: 18px;
  z-index: -1;
  margin: -2px;
}

.projects .card:hover {
  transform: translateY(-6px) scale(1.02);
}

/* Technology tags styling */
.projects .tag {
  background: var(--accent-color);
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 500;
}

/* Project card with icon styling */
.card {
  display: flex;
  flex-direction: column;
}

.card-icon {
  flex-shrink: 0;
  margin-bottom: 16px;
  text-align: center;
}

.project-card-icon {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  object-fit: cover;
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.card:hover .project-card-icon {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.card-content {
  flex: 1;
}

/* Project cards horizontal layout on larger screens */
@media (min-width: 768px) {
  .projects .card {
    flex-direction: row;
    align-items: flex-start;
  }
  
  .projects .card-icon {
    margin-right: 20px;
    margin-bottom: 0;
    text-align: left;
  }
  
  .projects .project-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
  }
}

/* Dark theme app icon adjustments */
:root[data-theme="dark"] .project-card-icon {
  border: 1px solid var(--border-medium);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .card:hover .project-card-icon {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.item-meta {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.item-excerpt {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.011em;
  line-height: 1.47059;
  color: var(--text-tertiary);
  margin: 0.5rem 0 0 0;
}

/* Tags */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.tag {
  display: inline-block;
  background-color: var(--accent-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tag:hover {
  background-color: var(--text-color);
  color: var(--bg-color);
  transform: scale(1.05);
}

/* Post content styling */
.item-content,
.page-content,
.section-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 60px 0;
}

.item-header {
  text-align: center;
  margin-bottom: 60px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--separator);
}

.item-header h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.item-meta {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-secondary);
}

.item-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-style: italic;
  margin: 0.5rem 0;
}

.content {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.011em;
  line-height: 1.64706;
  color: var(--text-primary);
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

.content h1 { font-size: 32px; line-height: 1.125; }
.content h2 { font-size: 28px; line-height: 1.14286; }
.content h3 { font-size: 24px; line-height: 1.16667; }

.content p {
  margin: 16px 0;
}

.content a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.content a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  overflow-x: auto;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.42857;
}

.content code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 14px;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--code-text);
}

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

.content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 24px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-tertiary);
}

.content ul,
.content ol {
  margin: 16px 0;
  padding-left: 32px;
}

.content li {
  margin: 8px 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.content th,
.content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.content th {
  background: var(--bg-secondary);
  font-weight: 600;
}

/* Back link */
.browse-all {
  display: inline-flex;
  align-items: center;
  font-size: 17px;
  font-weight: 400;
  color: var(--link-color);
  text-decoration: none;
  margin: 40px 0;
  padding: 8px 0;
  transition: all 0.2s ease;
}

.browse-all:hover {
  color: var(--link-hover);
  transform: translateX(-4px);
}

.browse-all::before {
  content: "←";
  margin-right: 8px;
  font-size: 20px;
}

/* All tags page */
.all-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.all-tags .tag {
  font-size: 1rem;
  padding: 0.5rem 1rem;
}

.tag-details-content h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 40px;
  text-align: center;
}

.tag-list-content h1 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 40px;
  text-align: center;
}

/* Footer */
footer {
  text-align: center;
  padding: 60px 0 40px;
  border-top: 1px solid var(--separator);
  margin-top: 80px;
}

footer p {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

footer a {
  color: var(--link-color);
  text-decoration: none;
}

footer a:hover {
  color: var(--link-hover);
}

/* Responsive design */
@media (max-width: 768px) {
  .wrapper {
    padding: 0 16px;
  }
  
  .nav-links {
    gap: 16px;
  }
  
  nav ul {
    gap: 16px;
  }
  
  nav a {
    font-size: 11px;
    padding: 6px 10px;
  }
  
  main {
    padding: 0 16px;
  }
  
  .hero {
    padding: 60px 0 40px;
  }
  
  .hero h1 {
    font-size: 40px;
    line-height: 1.1;
  }
  
  .hero .description {
    font-size: 17px;
    margin-bottom: 32px;
  }
  
  .section,
  .recent-posts {
    padding: 60px 0;
  }
  
  .section h2,
  .recent-posts h2 {
    font-size: 32px;
    margin-bottom: 40px;
  }
  
  .item-list {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .card {
    padding: 24px;
  }
  
  .item-content,
  .page-content,
  .section-content {
    padding: 40px 0;
  }
  
  .item-header h1,
  .tag-details-content h1,
  .tag-list-content h1 {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }
  
  .header-content {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    height: auto;
    padding: 1rem 0;
  }
  
  .nav-links {
    justify-content: center;
  }
  
  nav ul {
    justify-content: center;
  }
  
  .hero h1 {
    font-size: 32px;
  }
  
  .section h2,
  .recent-posts h2 {
    font-size: 28px;
  }
  
  .item-header h1,
  .tag-details-content h1,
  .tag-list-content h1 {
    font-size: 28px;
  }
  
  main {
    max-width: 100%;
  }
}

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Focus states for accessibility */
nav a:focus,
.theme-toggle:focus,
.site-name:focus,
.card:focus,
.browse-all:focus,
.tag:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root[data-theme="light"] {
    --text-primary: #000000;
    --text-secondary: #444444;
    --border-light: #666666;
  }
  
  :root[data-theme="dark"] {
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-light: #999999;
  }
}

/* Resume-specific styles */
.contact-info {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  text-align: center;
}

.contact-info p {
  margin: 8px 0;
  line-height: 1.5;
}

.contact-info strong {
  color: var(--text-primary);
  font-weight: 600;
}

.contact-info a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.contact-info a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Resume section styling */
.main-content h1 + div.contact-info + hr,
.main-content h2 + hr,
.main-content hr {
  border: none;
  height: 2px;
  background: var(--border-light);
  margin: 32px 0;
  border-radius: 1px;
}

/* Improve bullet point spacing for resume */
.main-content li {
  margin: 8px 0;
  line-height: 1.6;
}

/* Better spacing for job positions */
.main-content h3 {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  margin: 24px 0 12px 0;
  line-height: 1.3;
}

/* Date styling */
.main-content h3 + p strong,
.main-content h3 + p {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* Skills section improvements */
.main-content h3[id*="programming"] + p,
.main-content h3[id*="ios"] + p,
.main-content h3[id*="architecture"] + p,
.main-content h3[id*="databases"] + p,
.main-content h3[id*="development"] + p,
.main-content h3[id*="additional"] + p {
  line-height: 1.8;
  margin-bottom: 20px;
}

/* More posts link styling */
.more-posts {
  margin-top: 32px;
  text-align: center;
}

.more-link {
  display: inline-block;
  color: var(--link-color);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 12px 24px;
  border: 2px solid var(--link-color);
  border-radius: 8px;
  transition: all 0.2s ease;
  background: transparent;
}

.more-link:hover {
  color: var(--bg-primary);
  background: var(--link-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* Dark theme adjustments for more link */
:root[data-theme="dark"] .more-link:hover {
  box-shadow: 0 4px 12px rgba(41, 151, 255, 0.4);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}