/**
 * Component styles for dark theme
 */

/* Code blocks */
pre {
  border: 1px solid #444 !important;
  background-color: #2a2a2a !important;
  color: #e0e0e0 !important;
  overflow-x: visible;
  overflow-y: visible;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 100%;
}

pre code {
  display: block;
  border: 0;
  padding-right: 0;
  padding-left: 0;
  background-color: transparent !important;
  color: #e0e0e0 !important;
}

/* Inline code - allows wrapping with text */
p code,
li code,
td code,
article code:not(pre code) {
  display: inline !important;
  white-space: normal !important;
  border: 1px solid #444;
  background-color: #2a2a2a;
  color: #e0e0e0;
  padding: 1px 5px;
  border-radius: 3px;
}

/* Blog post inline code - specific override for article content */
article code:not(pre code),
article p code:not(pre code),
.post-content code:not(pre code),
.post-content p code:not(pre code),
.page-content code:not(pre code),
.page-content p code:not(pre code) {
  display: inline !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  word-wrap: normal !important;
  max-width: none !important;
  min-width: 0 !important;
  width: auto !important;
  flex-shrink: 0 !important;
}

/* Hide scrollbars */
pre::-webkit-scrollbar,
code::-webkit-scrollbar {
  display: none;
}

pre,
code {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Ensure code blocks expand to full width */
.highlight,
.highlighter-rouge {
  overflow: visible;
  max-width: 100%;
}

.highlight pre {
  overflow: visible;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Code block wrapper for copy button */
.code-block-wrapper {
  position: relative;
}

/* Copy button */
.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: #3a3a3a;
  border: 1px solid #555;
  color: #e0e0e0;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition:
    background-color 0.2s,
    border-color 0.2s;
  z-index: 10;
  opacity: 0.8;
}

.copy-button:hover {
  background-color: #4a4a4a;
  border-color: #666;
  opacity: 1;
}

.copy-button:active {
  background-color: #2a2a2a;
}

.copy-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
}

.copy-button-copied {
  background-color: #4a4a4a;
  border-color: #666;
  color: #e0e0e0;
}

.copy-button-copied:hover {
  background-color: #5a5a5a;
  border-color: #777;
}

/* Site header */
.site-header {
  border-top: none !important;
  border-bottom: 1px solid #444;
  background-color: #1a1a1a;
}

.site-header .wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.site-title,
.site-title:visited {
  color: #ffffff;
}

.site-description {
  color: #b0b0b0;
  font-size: 0.9rem;
  margin-left: auto;
  padding-left: 1rem;
}

/* Hide navigation completely - it's empty and creates a grey bar */
.site-nav {
  display: none !important;
}

.site-nav .page-link {
  color: #e0e0e0;
}

.site-nav .menu-icon > svg {
  fill: #e0e0e0;
}

/* Hide hamburger menu on all screen sizes */
.nav-trigger {
  display: none;
}

.site-nav label[for='nav-trigger'] {
  display: none;
}

/* Ensure navigation links are always visible */
.site-nav .trigger {
  display: block;
}

/* Site footer */
.site-footer {
  border-top: 1px solid #444;
  background-color: #1a1a1a;
}

.footer-col-wrapper {
  color: #b0b0b0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-col-1,
.footer-col-3 {
  display: none;
}

.footer-col-2 {
  text-align: center;
  width: 100%;
}

.footer-col-2 p {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  white-space: nowrap;
}

.github-link {
  color: #b0b0b0 !important;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.github-link:hover {
  color: #e0e0e0 !important;
}

.github-link svg {
  vertical-align: middle;
  transform: translateY(1px);
  /* Uncomment the line below to visually verify alignment with text baseline */
  /* outline: 1px solid red; */
}

.footer-link {
  color: #b0b0b0 !important;
  text-decoration: none;
}

.footer-link:hover {
  color: #e0e0e0 !important;
}

#render-time {
  display: block !important;
  color: #b0b0b0 !important;
  text-align: center;
  white-space: normal !important;
}

/* Tables */
table {
  color: #e0e0e0;
  border: 1px solid #444;
}

table tr:nth-child(even) {
  background-color: #2a2a2a;
}

table th {
  background-color: #333;
  border: 1px solid #444;
  border-bottom-color: #555;
}

table td {
  border: 1px solid #444;
}

/* Post navigation - position links on opposite sides */
.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #444;
  gap: 1rem;
}

.post-nav-link {
  text-decoration: none;
  color: #4a9eff;
}

.post-nav-link:hover {
  color: #6bb3ff;
  text-decoration: underline;
}

.post-nav-prev {
  margin-left: auto;
}

.post-nav-next {
  margin-right: auto;
}
