/* minimal additional css - main styling in main.scss */

/* ============================================ */
/* Modern UI Enhancements                       */
/* ============================================ */

/* Smooth scroll behavior for anchor links */
html {
  scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it (accessibility) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip to main content link for keyboard navigation (WCAG AA) */
.skip-to-main {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2c3e50;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 0.5rem 0.5rem;
  text-decoration: none;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: top 0.3s ease;
}

.skip-to-main:focus {
  top: 0;
  outline: 3px solid #d4a574;
  outline-offset: 2px;
}

/* Reading progress indicator for blog posts */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, #d4a574, #b44d2f);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 9999;
  transition: transform 0.1s ease-out;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, #2c3e50 0%, #1c2328 100%);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: linear-gradient(135deg, #b44d2f 0%, #8a3a24 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.back-to-top:active {
  transform: translateY(-1px);
}

.back-to-top:focus-visible {
  outline: 3px solid #d4a574;
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
}

/* Enhanced image loading with fade-in */
img {
  transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"] {
  opacity: 0;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Enhanced focus indicators when using keyboard navigation */
body.keyboard-nav *:focus {
  outline: 3px solid #d4a574 !important;
  outline-offset: 3px !important;
}

body.keyboard-nav *:focus:not(:focus-visible) {
  outline: none;
}

/* utility classes for dynamic content sections */
.see-all-link {
  font-weight: 500;
  margin-top: 0.5rem;
  display: inline-block;
}

/* ============================================ */
/* Margin Notes & Asides                        */
/* ============================================ */

/* Quarto's column-margin class for side notes */
.column-margin {
  font-size: 0.9em;
  color: #3d4246;
  line-height: 1.5;
  padding: 0.75em 0;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Desktop: margin notes appear in the right margin */
@media (min-width: 992px) {
  .column-margin {
    /* Quarto handles positioning, we just style */
    font-size: 0.85em;
    padding: 0.875em 1.25em;
    background-color: rgba(232, 228, 223, 0.85); /* $gray-100 with more opacity for full coverage */
    border-left: 3px solid #d4a574; /* warm brown accent */
    border-radius: 0.5em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Ensure the box covers all text */
    display: block;
    width: 100%;
  }
}

/* Mobile/Tablet: margin notes appear inline */
@media (max-width: 991px) {
  .column-margin {
    display: block;
    margin: 1.25em 0;
    padding: 1.25em;
    background-color: rgba(232, 228, 223, 0.85); /* $gray-100 with more opacity */
    border-left: 4px solid #d4a574; /* warm brown accent */
    border-radius: 0.5em;
    font-size: 0.9em;
    color: #2d3236;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

/* Alternative syntax: aside elements */
aside,
.aside {
  font-size: 0.9em;
  color: #3d4246;
  line-height: 1.5;
  padding: 0.75em 0;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Desktop: asides in margin */
@media (min-width: 992px) {
  aside,
  .aside {
    font-size: 0.85em;
    padding: 0.875em 1.25em;
    background-color: rgba(232, 228, 223, 0.85); /* $gray-100 with more opacity for full coverage */
    border-left: 3px solid #d4a574;
    border-radius: 0.5em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Ensure the box covers all text */
    display: block;
    width: 100%;
  }
}

/* Mobile/Tablet: asides inline */
@media (max-width: 991px) {
  aside,
  .aside {
    display: block;
    margin: 1.25em 0;
    padding: 1.25em;
    background-color: rgba(232, 228, 223, 0.85); /* $gray-100 with more opacity */
    border-left: 4px solid #d4a574;
    border-radius: 0.5em;
    font-size: 0.9em;
    color: #2d3236;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

/* Ensure margin notes are accessible */
.column-margin:focus,
aside:focus,
.aside:focus {
  outline: 2px solid #d4a574;
  outline-offset: 2px;
}

/* Style links within margin notes */
.column-margin a,
aside a,
.aside a {
  color: #2c3e50;
  text-decoration: underline;
  text-decoration-color: rgba(212, 165, 116, 0.5);
}

.column-margin a:hover,
aside a:hover,
.aside a:hover {
  color: #e17055;
  text-decoration-color: #e17055;
}

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

.error-404 {
  max-width: 700px;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
}

.error-404 h2 {
  color: #2c3e50;
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.error-404 h3 {
  color: #d4a574;
  font-size: 1.3rem;
  margin: 2rem 0 1rem 0;
  text-align: left;
}

.error-404 p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #5a6568;
  margin-bottom: 1.5rem;
}

.error-404 ul {
  text-align: left;
  font-size: 1.05rem;
  line-height: 2;
  margin: 1rem 0 2rem 1.5rem;
}

.error-404 ul li {
  margin-bottom: 0.75rem;
}

.error-404 a {
  color: #2c3e50;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(212, 165, 116, 0.4);
  transition: all 0.2s ease;
}

.error-404 a:hover {
  color: #b44d2f;
  text-decoration-color: #b44d2f;
}

.error-404 hr {
  border: none;
  border-top: 2px solid rgba(212, 165, 116, 0.3);
  margin: 2.5rem 0;
}
