/* Mobile-First Optimizations */

/* Base mobile styles */
@media screen and (max-width: 768px) {
  /* Better padding and spacing for mobile */
  #wrapper {
    padding: 0.75rem 1rem !important;
  }
  
  /* Header optimizations - Show only "Backend Guy" on mobile */
  #header {
    padding-top: 1rem;
  }
  
  #header > h1 > a {
    font-size: 0 !important;
    line-height: 1.3;
  }
  
  #header > h1 > a::after {
    content: "Backend Guy";
    font-size: 1.75rem !important;
    display: block;
  }
  
  #header > h1 {
    margin-bottom: 0.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
  }
  
  /* Navigation spacing */
  #header > nav {
    margin-top: 0.5rem;
    gap: 0.75rem;
  }
  
  #header > nav > span > a {
    font-size: 1.1rem !important;
    padding: 0.25rem 0.5rem;
  }
  
  /* Main content area */
  #main {
    width: 100% !important;
    padding: 0 !important;
  }
  
  main {
    margin: 0 !important;
  }
  
  /* Content typography for better mobile readability */
  .content {
    font-size: 1rem;
    line-height: 1.6;
  }
  
  .content p {
    text-align: left !important; /* Remove justify on mobile for better readability */
    margin-bottom: 1rem;
    hyphens: auto;
    -webkit-hyphens: auto;
    word-wrap: break-word;
  }
  
  /* Heading sizes for mobile */
  .content h1 {
    font-size: 1.75rem !important;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .content h2 {
    font-size: 1.5rem !important;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
  }
  
  .content h3 {
    font-size: 1.25rem !important;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .content h4 {
    font-size: 1.1rem !important;
  }
  
  /* List improvements for mobile */
  .content ol,
  .content ul {
    margin-left: 1.25rem !important;
    padding-left: 0;
  }
  
  .content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
  }
  
  /* Code blocks for mobile */
  .content pre {
    padding: 0.75rem !important;
    font-size: 0.85rem;
    border-radius: 0.25rem;
  }
  
  .content code {
    font-size: 0.9rem;
  }
  
  /* Blockquotes */
  .content blockquote {
    padding: 0.75rem 1rem !important;
    margin-left: 0;
    margin-right: 0;
  }
  
  /* Tables */
  .content table {
    font-size: 0.9rem;
  }
  
  
  /* Footer */
  #footer {
    margin-top: 2rem;
    padding: 1rem 0;
    font-size: 0.85rem;
  }
  
  /* Homepage specific mobile styles */
  .homepage-content {
    padding: 0 0.5rem;
  }
  
  /* Pagination */
  .paginator {
    font-size: 0.9rem;
    margin-top: 1.5rem;
  }
}

/* Small phone optimization (iPhone SE, etc.) */
@media screen and (max-width: 375px) {
  #header > h1 > a::after {
    font-size: 1.5rem !important;
  }
  
  #header > nav > span > a {
    font-size: 1rem !important;
  }
  
  .content h1 {
    font-size: 1.5rem !important;
  }
  
  .content h2 {
    font-size: 1.3rem !important;
  }
  
  .content h3 {
    font-size: 1.15rem !important;
  }
}

/* Improve tap targets for mobile */
@media (hover: none) and (pointer: coarse) {
  a, button {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  #header > nav > span > a {
    padding: 0.5rem 0.75rem;
  }
}

/* Landscape mobile optimization */
@media screen and (max-width: 768px) and (orientation: landscape) {
  #header > h1 > a::after {
    font-size: 1.5rem !important;
  }
  
  #header > h1 {
    margin-bottom: 0.25rem;
  }
  
  #header > nav {
    margin-top: 0.25rem;
  }
}

/* Better scrollbar for mobile */
@media screen and (max-width: 768px) {
  ::-webkit-scrollbar {
    height: 6px;
    width: 6px;
  }
}

/* Optimize images for mobile */
@media screen and (max-width: 768px) {
  .content img {
    width: 100%;
    height: auto;
    border-radius: 0.25rem;
  }
}

/* Enhanced Code Block Styling for Better Readability */

/* Code blocks - remove vertical lines and clean up */
pre {
  background-color: #f6f8fa !important;
  border: 1px solid #d1d9e0 !important;
  border-radius: 6px !important;
  padding: 1rem !important;
  overflow-x: auto;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace !important;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 1rem 0 !important;
  color: #24292e !important;
  position: relative !important;
}

/* Remove any pseudo-elements that might be creating lines */
pre::before, pre::after {
  display: none !important;
  content: none !important;
}

/* Remove lines from any syntax highlighting elements */
.highlight::before, .highlight::after {
  display: none !important;
  content: none !important;
}

/* Override theme's CSS variables for inline code */
:root {
  --code-bg: rgba(234, 88, 12, 0.15);
  --code-color: #ea580c;
}

html.darkmode,
.darkmode {
  --code-bg: rgba(251, 146, 60, 0.25);
  --code-color: #fbbf24;
}

/* Inline code styling using theme's approach but with orange */
.content code {
  background-color: var(--code-bg) !important;
  color: var(--code-color) !important;
  border: 1px solid rgba(251, 146, 60, 0.3) !important;
  font-weight: 500 !important;
}

/* Code inside pre blocks shouldn't have inline styling */
pre code {
  background-color: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  color: inherit !important;
  font-size: inherit !important;
}

/* Syntax highlighting colors for Go code - subtle and readable */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr { color: #333333; font-weight: 600; } /* Keywords */
.highlight .s, .highlight .s1, .highlight .s2 { color: #444444; } /* Strings */
.highlight .c1, .highlight .cm { color: #666666; font-style: italic; } /* Comments */
.highlight .nf { color: #333333; } /* Function names */
.highlight .nx { color: #333333; } /* Variables */
.highlight .p { color: #333333; } /* Punctuation */

/* Better mobile code block styling */
@media screen and (max-width: 768px) {
  pre {
    font-size: 0.8rem !important;
    padding: 0.75rem !important;
    margin: 0.75rem 0 !important;
    border-radius: 4px !important;
  }
  
  code {
    font-size: 0.8rem !important;
  }
  
  /* Horizontal scroll for code on mobile */
  pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Ensure consistent background for highlighted code */
.highlight { background-color: #f6f8fa !important; }

/* Better contrast for code blocks */
pre, code {
  color: #24292e !important;
}