/* ========================================
   Custom Styles for andremiller Theme
   Bootstrap 5.3 + Dark Mode Support
   ======================================== */

/* === Typography === */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

.display-4, .display-5 {
  letter-spacing: -0.02em;
}

/* === Article & Page Content Styling === */
.article-content,
.page-content {
  font-size: 1.1rem;
  line-height: 1.8;
}

.article-content h2,
.page-content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.article-content h3,
.page-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.article-content p,
.page-content p {
  margin-bottom: 1.25rem;
}

.article-content img,
.page-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.375rem;
  margin: 1.5rem 0;
}

.article-content pre,
.page-content pre {
  background-color: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-content code,
.page-content code {
  background-color: var(--bs-secondary-bg);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.article-content pre code,
.page-content pre code {
  background-color: transparent;
  padding: 0;
}

.article-content blockquote,
.page-content blockquote {
  border-left: 4px solid var(--bs-primary);
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--bs-secondary-color);
}

.article-content ul,
.article-content ol,
.page-content ul,
.page-content ol {
  margin-bottom: 1.25rem;
  padding-left: 2rem;
}

.article-content li,
.page-content li {
  margin-bottom: 0.5rem;
}

.article-content table,
.page-content table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
}

.article-content table th,
.article-content table td,
.page-content table th,
.page-content table td {
  padding: 0.75rem;
  border: 1px solid var(--bs-border-color);
}

.article-content table th,
.page-content table th {
  background-color: var(--bs-secondary-bg);
  font-weight: 600;
}

/* === Card Enhancements === */
.card {
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  border: 1px solid var(--bs-border-color);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Dark mode card hover shadow */
[data-bs-theme="dark"] .card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.4) !important;
}

/* Constrain images in card summaries */
.card-body img,
.card-text img {
  max-width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  border-radius: 0.25rem;
  margin: 0.5rem 0;
}

/* Hide images in card summaries to keep cards clean (optional alternative) */
/* Uncomment the following lines if you prefer to hide images entirely in summaries */
/*
.card-body img,
.card-text img {
  display: none;
}
*/

/* Constrain headings in card summaries */
.card-body h1,
.card-body h2,
.card-body h3,
.card-body h4,
.card-body h5,
.card-body h6,
.card-text h1,
.card-text h2,
.card-text h3,
.card-text h4,
.card-text h5,
.card-text h6 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

/* === Theme Toggle Button === */
#theme-toggle {
  border: none;
  background: transparent;
  padding: 0.5rem;
  cursor: pointer;
}

#theme-toggle:hover {
  background-color: var(--bs-tertiary-bg);
  border-radius: 0.375rem;
}

/* === Navbar Enhancements === */
.navbar-brand {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.navbar {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* === Footer Styling === */
footer a {
  color: var(--bs-body-color);
  transition: color 0.2s ease-in-out;
}

footer a:hover {
  color: var(--bs-primary);
}

/* === Badge Styling === */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
}

/* === List Group Enhancements === */
.list-group-item {
  border-color: var(--bs-border-color);
}

.list-group-item:hover {
  background-color: var(--bs-tertiary-bg);
}

/* === Responsive Adjustments === */
@media (max-width: 768px) {
  .article-content,
  .page-content {
    font-size: 1rem;
  }

  .display-4 {
    font-size: 2.5rem;
  }

  .display-5 {
    font-size: 2rem;
  }
}

/* === Print Styles === */
@media print {
  .navbar,
  footer,
  #theme-toggle {
    display: none;
  }

  .article-content,
  .page-content {
    font-size: 12pt;
  }
}

/* === Accessibility === */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* === Smooth Transitions === */
/* Apply transitions only to interactive elements, not everything */
a,
button,
.btn,
.nav-link,
.card,
.list-group-item,
.badge,
input,
select,
textarea {
  transition: all 0.15s ease-in-out;
}

/* Remove transitions during theme changes to prevent flicker */
html[data-bs-theme-switching] * {
  transition: none !important;
}
