/* ============================================
   Modern Dark Hacker Aesthetic - Custom Styles
   ============================================ */

/* ===================
   GLITCH ANIMATIONS
   =================== */

/* Logo Glitch - Continuous, Subtle */
@keyframes glitch-logo {
  0%, 100% {
    text-shadow: 0 0 1px var(--glow-accent);
    transform: translate(0, 0);
  }
  10%, 30%, 50%, 70%, 90% {
    text-shadow:
      -2px 0 2px rgba(255, 0, 110, 0.8),
      2px 0 2px rgba(0, 217, 255, 0.8),
      0 0 8px var(--glow-accent);
    transform: translate(-1px, 0);
  }
  15%, 35%, 55%, 75%, 95% {
    text-shadow:
      2px 0 2px rgba(255, 0, 110, 0.8),
      -2px 0 2px rgba(0, 217, 255, 0.8);
    transform: translate(1px, 0);
  }
}

/* Heading Glitch - Hover-triggered */
@keyframes glitch-heading {
  0%, 100% {
    transform: translate(0);
    opacity: 1;
  }
  20% {
    transform: translate(-2px, 1px);
    opacity: 0.8;
  }
  40% {
    transform: translate(2px, -1px);
    opacity: 0.9;
  }
  60% {
    transform: translate(-1px, -2px);
    opacity: 0.85;
  }
  80% {
    transform: translate(1px, 2px);
    opacity: 0.95;
  }
}

/* Flicker Effect - Occasional */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  41%, 43% { opacity: 0.85; }
  46%, 48% { opacity: 0.92; }
  51%, 53% { opacity: 0.88; }
}

/* Scan Line Animation */
@keyframes scan {
  0% { top: 0; }
  100% { top: 100%; }
}

/* Pulse Animation for Borders */
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

/* ===================
   LOGO STYLING
   =================== */

.logo {
  animation: glitch-logo 3s ease-in-out infinite;
  will-change: transform, text-shadow;
}

/* ===================
   HEADING STYLES
   =================== */

h1:hover {
  animation: glitch-heading 0.3s ease-in-out;
}

/* Code block titles with flicker */
.highlight pre:hover::before {
  animation: flicker 5s ease-in-out infinite;
}

/* ===================
   ENHANCED CODE BLOCKS
   =================== */

.highlight,
pre {
  background: var(--code-bg) !important;
  border: 1px solid var(--code-border);
  border-left: 3px solid var(--accent);
  box-shadow:
    0 0 10px rgba(0, 255, 65, 0.1),
    inset 0 0 20px rgba(0, 255, 65, 0.02);
  position: relative;
  overflow: auto;
}

/* Inline code */
code {
  background: var(--code-bg);
  color: var(--code-accent);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  border: 1px solid var(--code-border);
}

/* Don't double-style code inside pre */
pre code {
  border: none;
  padding: 0;
  background: transparent;
}

/* Subtle scan line effect on code blocks */
pre::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(0, 255, 65, 0.3),
    transparent
  );
  animation: scan 6s linear infinite;
  pointer-events: none;
  z-index: 1;
}

/* ===================
   ENHANCED LINKS
   =================== */

a {
  color: var(--accent-secondary);
  text-decoration: none;
  position: relative;
  transition: all 0.2s ease;
}

a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

a:hover {
  color: var(--accent);
  text-shadow: 0 0 8px var(--glow-accent);
}

a:hover::after {
  width: 100%;
}

/* Navigation links - no underline animation */
.menu a::after,
.header a::after {
  display: none;
}

.menu a:hover,
.header a:hover {
  text-shadow: 0 0 8px var(--glow-accent);
}

/* ===================
   BUTTON ENHANCEMENTS
   =================== */

button,
.button,
input[type="submit"],
input[type="button"] {
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--foreground);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  position: relative;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  background: var(--accent);
  color: var(--background);
  box-shadow:
    0 0 20px var(--glow-accent),
    inset 0 0 10px rgba(0, 255, 65, 0.2);
  transform: translateY(-1px);
}

button:active,
.button:active,
input[type="submit"]:active,
input[type="button"]:active {
  transform: translateY(0);
}

/* ===================
   CONTAINER & LAYOUT
   =================== */

.container {
  border-right: 1px solid var(--code-border);
  box-shadow: 4px 0 20px var(--shadow-primary);
}

/* ===================
   POST STYLING
   =================== */

.post:not(:last-of-type) {
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(
    90deg,
    transparent,
    var(--accent) 50%,
    transparent
  ) 1;
  padding-bottom: 30px;
  margin-bottom: 30px;
}

/* Post meta information */
.post-meta,
.post-date {
  color: var(--foreground-dim);
}

/* ===================
   ENHANCED HEADER
   =================== */

.header {
  border-bottom: 1px solid var(--code-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ===================
   PAGINATION
   =================== */

.pagination__buttons {
  gap: 10px;
}

.pagination__buttons a,
.pagination__buttons span {
  border: 2px solid var(--code-border);
  transition: all 0.3s ease;
}

.pagination__buttons a:hover {
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--glow-accent);
}

/* ===================
   TABLES
   =================== */

table {
  border: 1px solid var(--code-border);
}

th {
  background: var(--background-secondary);
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

td {
  border: 1px solid var(--code-border);
}

tr:hover {
  background: var(--background-secondary);
}

/* ===================
   BLOCKQUOTES
   =================== */

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  color: var(--foreground-dim);
  background: var(--background-secondary);
  padding: 15px 20px;
  margin: 25px 0;
  position: relative;
}

blockquote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow-accent);
}

/* ===================
   IMAGES
   =================== */

img {
  border: 2px solid var(--code-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

img:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--glow-accent);
  transform: translateY(-2px);
}

/* ===================
   FORM ELEMENTS
   =================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea {
  background: var(--background-secondary);
  border: 1px solid var(--code-border);
  color: var(--foreground);
  padding: 8px 12px;
  font-family: inherit;
  transition: all 0.3s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--glow-accent);
}

/* ===================
   SELECTION
   =================== */

::selection {
  background: var(--accent);
  color: var(--background);
}

::-moz-selection {
  background: var(--accent);
  color: var(--background);
}

/* ===================
   SCROLLBAR
   =================== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--background);
  border: 1px solid var(--code-border);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
  box-shadow: 0 0 10px var(--glow-accent);
}

/* ===================
   UTILITY CLASSES
   =================== */

/* Apply glitch effect to any element */
.glitch {
  animation: glitch-heading 0.3s ease-in-out infinite;
}

/* Glow effect utility */
.glow {
  box-shadow: 0 0 20px var(--glow-accent);
}

/* Highlight text */
.highlight-text {
  color: var(--accent);
  text-shadow: 0 0 5px var(--glow-accent);
}

/* ===================
   FOCUS INDICATORS
   =================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===================
   SEARCH INTERFACE
   =================== */

/* Search Overlay */
#search-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 20, 0.95);
  backdrop-filter: blur(5px);
  z-index: 9999;
  padding: 20px;
  overflow-y: auto;
}

#search-overlay.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Search Container */
.search-container {
  width: 100%;
  max-width: 800px;
  margin-top: 100px;
}

/* Search Input */
#search-input {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.2rem;
  background: var(--background-secondary);
  border: 2px solid var(--code-border);
  border-radius: 0;
  color: var(--foreground);
  font-family: inherit;
  transition: all 0.3s ease;
}

#search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--glow-accent);
}

#search-input::placeholder {
  color: var(--foreground-dim);
}

/* Search Results */
#search-results {
  margin-top: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 15px;
  margin-bottom: 10px;
  background: var(--background-secondary);
  border: 1px solid var(--code-border);
  border-left: 3px solid var(--accent-secondary);
  transition: all 0.3s ease;
  text-decoration: none;
}

.search-result-item:hover {
  border-left-color: var(--accent);
  box-shadow: 0 0 15px var(--glow-accent);
  transform: translateX(5px);
}

.search-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.search-result-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--foreground);
}

.search-result-section {
  font-size: 0.9rem;
  color: var(--accent-secondary);
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--accent-secondary);
}

.search-result-snippet {
  color: var(--foreground-dim);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 8px;
}

.search-result-snippet mark {
  background: var(--accent);
  color: var(--background);
  padding: 2px 4px;
  font-weight: bold;
}

.search-result-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.search-tag {
  font-size: 0.8rem;
  padding: 2px 8px;
  background: var(--code-bg);
  color: var(--accent);
  border: 1px solid var(--code-border);
}

.search-no-results {
  text-align: center;
  padding: 40px;
  color: var(--foreground-dim);
  font-size: 1.1rem;
}

/* Search Button in Header */
.search-button {
  background: transparent;
  border: 1px solid var(--code-border);
  color: var(--foreground);
  padding: 5px 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  font-size: 0.9rem;
}

.search-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 10px var(--glow-accent);
}

.search-button::before {
  content: "/";
  margin-right: 5px;
  color: var(--accent);
}

/* Search Hint */
.search-hint {
  text-align: center;
  color: var(--foreground-dim);
  font-size: 0.9rem;
  margin-top: 10px;
}

.search-hint kbd {
  background: var(--code-bg);
  padding: 2px 8px;
  border: 1px solid var(--code-border);
  font-family: inherit;
  color: var(--accent);
}

/* Close Button */
.search-close {
  position: fixed;
  top: 30px;
  right: 30px;
  background: transparent;
  border: 2px solid var(--accent-danger);
  color: var(--accent-danger);
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-close:hover {
  background: var(--accent-danger);
  color: var(--background);
  transform: rotate(90deg);
}

/* ===================
   RESPONSIVE ADJUSTMENTS
   =================== */

@media (max-width: 684px) {
  .container {
    box-shadow: none;
    border-right: none;
  }

  img:hover {
    transform: none;
  }

  /* Reduce animation intensity on mobile */
  .logo {
    animation-duration: 5s;
  }
}

/* ===================
   ACCESSIBILITY
   =================== */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .logo {
    animation: none;
  }

  h1:hover {
    animation: none;
  }

  pre::before {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --foreground: #ffffff;
    --background: #000000;
    --accent: #00ff00;
  }
}
/* ============================================
   LOGO IMAGE STYLING
   ============================================ */

.logo-image {
  height: 75px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 0 5px var(--glow-accent));
  transition: all 0.3s ease;
}

.logo-image:hover {
  filter: drop-shadow(0 0 10px var(--accent)) 
          drop-shadow(0 0 20px var(--accent-secondary));
  transform: scale(1.05);
}

/* Mobile logo sizing */
@media (max-width: 684px) {
  .logo-image {
    height: 50px;
  }
}
