/* Black and White Color Scheme Override */
:root {
  --background: #ffffff;
  --foreground: #000000;
  --accent: #000000;
  --border-color: #000000;
}

/* Ensure body uses the variables */
body {
  background-color: var(--background);
  color: var(--foreground);
}

/* Links */
a {
  color: var(--accent);
}

/* Buttons */
button,
.button {
  color: var(--accent);
  border-color: var(--accent);
}

button:hover,
.button:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Menu items */
.menu a {
  color: var(--foreground);
}

/* Logo */
.logo a {
  color: var(--foreground);
}

/* Post titles */
.post-title a {
  color: var(--foreground);
}

/* Code blocks stay inverted for readability */
pre {
  background-color: #000000 !important;
  overflow-x: auto !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

pre code {
  color: #ffffff !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Ensure chroma syntax highlighted code also wraps */
.chroma,
.chroma code,
.highlight pre,
.highlight code {
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Override line number table display to allow wrapping */
.chroma .lntd {
  vertical-align: top !important;
}

.chroma .lntd code {
  display: block !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Inline code */
code {
  background-color: #f0f0f0;
  color: #000000;
  padding: 2px 4px;
}

/* Post metadata */
.post-meta,
.post-date,
.post-author {
  color: var(--foreground);
  opacity: 0.7;
}

/* Tags */
.post-tags a {
  color: var(--foreground);
  border: 1px solid var(--border-color);
}

.post-tags a:hover {
  background-color: var(--foreground);
  color: var(--background);
}

/* Borders */
header {
  border-bottom: 1px solid var(--border-color);
}

footer {
  border-top: 1px solid var(--border-color);
}

/* Pagination */
.pagination {
  border-top: 1px solid var(--border-color);
}

.pagination__buttons a {
  border: 1px solid var(--border-color);
  color: var(--foreground);
}

.pagination__buttons a:hover {
  background-color: var(--foreground);
  color: var(--background);
}

/* Code copy button */
.highlight {
  position: relative;
}

.copy-code-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  background-color: var(--foreground);
  color: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-family: monospace;
}

.highlight:hover .copy-code-button {
  opacity: 1;
}

.copy-code-button:hover {
  opacity: 0.8 !important;
}

.copy-code-button:active {
  transform: scale(0.95);
}

.copy-code-button.copied {
  opacity: 1 !important;
}

/* Oscillating Hatching Animation Styles */

/* Base styles */
#animation-container {
  background: #FFFFFF;
}

#oscillating-hatching-canvas {
  display: block;
}

/* Desktop: Fixed top right position */
@media (min-width: 1024px) {
  /* Keep the content (including the right border) above the animation */
  .container {
    position: relative;
    z-index: 10;
  }

  .animation-sidebar {
    position: fixed;
    top: 50%;
    /* Responsive size for the animation box on desktop */
    --animation-size: clamp(420px, 34vw, 620px);

    /* Center the animation within the "right gutter" space when available,
       but never let it hug the edge too tightly on narrower desktop widths. */
    right: clamp(20px, calc((100vw - 864px - var(--animation-size)) / 2), 2000px);
    width: var(--animation-size);
    height: var(--animation-size);
    transform: translateY(-50%);
    z-index: 5;
    overflow: hidden;
  }

  #animation-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #oscillating-hatching-canvas {
    width: 100% !important;
    height: 100% !important;
    transform: none;
  }

  .animation-toggle-wrapper {
    display: none;
  }
}

/* Mobile: Hidden by default with toggle button */
@media (max-width: 1023px) {
  .animation-sidebar {
    position: relative;
    width: 100%;
  }

  .animation-toggle-wrapper {
    text-align: center;
    margin: 2rem 0 1rem;
  }

  #animation-toggle-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--foreground);
    color: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  #animation-toggle-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
  }

  #animation-toggle-btn:active {
    transform: translateY(0);
  }

  #animation-container {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.5s ease;
    padding: 0;
  }

  #animation-container.active {
    max-height: 600px;
    opacity: 1;
    padding: 0;
    margin-top: 1rem;
  }

  #oscillating-hatching-canvas {
    width: 100%;
    height: auto;
    max-width: 100%;
  }
}
