/* =========================================
   READING PROGRESS BAR
   ========================================= */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.1s linear;
  pointer-events: none;
}


/* =========================================
   BACK TO TOP BUTTON
   ========================================= */

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 200;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.back-to-top:hover {
  transform: translateY(-3px);
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.back-to-top[hidden] {
  display: none;
}


/* =========================================
   FOCUS STATES (A11Y)
   ========================================= */

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}


/* =========================================
   IMAGE FALLBACKS
   ========================================= */

.image-load-failed {
  display: none !important;
}


/* =========================================
   MOBILE TWEAKS
   ========================================= */

@media (max-width: 780px) {

  .back-to-top {
    width: 42px;
    height: 42px;
    bottom: 16px;
    right: 16px;
    font-size: 1.15rem;
  }

}


/* =========================================
   REDUCED MOTION
   ========================================= */

@media (prefers-reduced-motion: reduce) {

  .reading-progress {
    transition: none;
  }

  .back-to-top {
    transition: none;
  }

}

/* =========================================
   404 ERROR PAGE
   ========================================= */

.error-page {
  max-width: 720px;
  margin: 40px auto 80px;
  text-align: center;
}

.error-page-inner {
  padding: 40px 24px;
}

.error-code {
  margin: 0 0 20px;
  font-size: clamp(6rem, 18vw, 12rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--surface-soft);
  -webkit-text-stroke: 2px var(--accent);
  text-stroke: 2px var(--accent);
}

.error-page h1 {
  margin: 0 0 16px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.error-description {
  max-width: 560px;
  margin: 0 auto 32px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.65;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.error-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.error-actions .button-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.error-actions .button-primary:hover {
  transform: translateY(-2px);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.error-actions .button-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.error-actions .button-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
}

.error-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.error-links a {
  color: inherit;
  text-decoration: none;
}

.error-links a:hover {
  color: var(--accent);
}

@media (max-width: 600px) {

  .error-page {
    margin-top: 20px;
  }

  .error-page-inner {
    padding: 30px 16px;
  }

  .error-code {
    font-size: 6rem;
    -webkit-text-stroke-width: 1.5px;
  }

  .error-actions {
    flex-direction: column;
  }

  .error-actions .button {
    width: 100%;
  }

}
