/* Full-width news carousel */
.news-carousel {
  width: 100%;
  position: relative;
}

.news-carousel .carousel-inner,
.news-carousel .carousel-item {
  height: 60vh;
  overflow: hidden;
}

@media (max-width: 767.98px) {
  .news-carousel .carousel-inner,
  .news-carousel .carousel-item {
    height: 40vh;
  }
}

.news-slide-link {
  display: block;
  position: relative;
  height: 60vh;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
}

.news-slide-link:hover {
  color: #fff;
}

.news-slide-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 767.98px) {
  .news-slide-link {
    height: 40vh;
  }
}

.news-slide-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem 5rem 3.5rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  z-index: 2;
}

.news-slide-date {
  font-size: 0.9rem;
  opacity: 0.8;
  display: block;
  margin-bottom: 0.25rem;
}

.news-slide-title {
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Carousel focus visibility — pseudo-element overlay since img covers box-shadow */

#newsCarousel .carousel-item a:focus-visible {
  outline: none;
  box-shadow: none;
}

#newsCarousel .carousel-item a:focus-visible::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 3px solid #fd7e14;
  border-radius: 0.375rem;
  box-shadow: 0 0 8px rgba(253, 126, 20, 0.6);
  pointer-events: none;
  z-index: 5;
}

#newsCarousel .carousel-indicators button:focus-visible {
  outline: 2px solid #fd7e14;
  outline-offset: 2px;
}

.two-columns {
  column-count: 1;
  column-gap: 20px;
  text-align: justify;
}

span.no-wrap {
  white-space: nowrap;
}

/* Book/anthology modal polish */
.item-modal-content {
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

@media (max-width: 767.98px) {
  .item-modal .modal-dialog {
    margin: 0;
    max-width: 100%;
    min-height: 100vh;
  }

  .item-modal-content {
    max-height: 100vh;
    min-height: 100vh;
    border-radius: 0;
  }
}

.item-modal-content::-webkit-scrollbar {
  width: 6px;
}

.item-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.item-modal-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
}

.books-modal-title,
.anthology-modal-title {
  text-wrap: balance;
  margin-bottom: 2rem;
  color: #fff;
}

.modal-cover-img {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 8px 30px rgba(0, 0, 0, 0.4);
}

.item-modal-content .lead {
  color: rgba(255, 255, 255, 0.9);
}

.item-modal-content .modal-link {
  color: #fd7e14;
}

.item-modal-content .btn-outline-light {
  background: #3d5467;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}

.item-modal-content .btn-outline-light:hover {
  background: #4a6479;
}

/* Modal prev/next navigation */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.modal-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.modal-nav-prev {
  left: 0.75rem;
}

.modal-nav-next {
  right: 0.75rem;
}

/* Modal slides — stacked with crossfade */
.modal-body {
  position: relative;
}

.modal-slide {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.modal-slide.active {
  position: relative;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* Pull description text away from nav buttons */
.modal-description {
  padding-right: 3rem;
}

@media (max-width: 767.98px) {
  .modal-description {
    position: relative;
  }

  .modal-description .btn-outline-light {
    position: sticky;
    bottom: 0;
    display: block;
    width: 100%;
    z-index: 2;
    text-align: center;
    background: #3d5467;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 1rem;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
  }

  .modal-description .btn-outline-light::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 3rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    pointer-events: none;
  }
}

@media (min-width: 992px) {
  .two-columns {
    column-count: 2;
    column-gap: 80px;
  }
}

/* Book/anthology cover grid — natural aspect ratios, vertically centered */
.cover-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-wrapper img {
  width: 100%;
  height: auto;
  border-radius: 0.375rem;
}

/* Awards */
.award-figure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.25);
}

.award-figure .figure-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.4) saturate(0);
  margin: 0;
}

.award-caption {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  color: #fff;
  font-size: clamp(0.85rem, 2.5vw, 1.35rem);
  font-weight: 700;
  text-align: center;
  text-wrap: balance;
}

/* Bio rich text */
.bio-content a {
  color: #fd7e14;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.bio-content a:hover {
  color: #fff;
}

/* Standardized photo grid */
.photo-figure {
  cursor: pointer;
  display: block;
  width: 100%;
}

.photo-figure .figure-caption {
  margin-top: 0.75rem;
  text-wrap: balance;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.photo-figure:hover .figure-caption {
  transform: translateY(-2px);
  opacity: 0.75;
}

.photo-figure:hover .photo-wrapper img {
  opacity: 0.85;
}

.photo-wrapper {
  position: relative;
  overflow: hidden;
  padding-top: 75%; /* 4:3 aspect ratio */
  border-radius: 0.375rem;
}

.photo-wrapper img.img-fluid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  transition: opacity 0.2s ease;
}

/* Photo lightbox */
#photoLightbox .modal-dialog {
  max-width: 95vw;
  margin: 1rem auto;
}

#photoLightbox .modal-content {
  background: rgba(0, 0, 0, 0.65);
  border: none;
  box-shadow: none;
}

#photoLightbox .modal-body {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#photoLightboxImg {
  max-height: 85vh;
}

.lightbox-caption {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 600px;
  width: 100%;
  padding: 1.5rem 2rem;
  color: #fff;
  font-size: 1.15rem;
  text-align: center;
  text-wrap: balance;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  pointer-events: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.lightbox-nav:hover {
  opacity: 1;
}

/* Poem tab transitions */
/* Sticky poem nav on mobile */
@media (max-width: 767.98px) {
  #poetryTab {
    position: sticky;
    top: 56px; /* below collapsed navbar */
    z-index: 10;
    background: #3d5467;
    padding-bottom: 0.5rem;
  }
}

#poetryTabContent {
  max-height: 70vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

#poetryTabContent::-webkit-scrollbar {
  width: 6px;
}

#poetryTabContent::-webkit-scrollbar-track {
  background: transparent;
}

#poetryTabContent::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
}

.poem-scroll-indicator {
  text-align: center;
  padding: 0.5rem 0;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  transition: opacity 0.3s ease;
}

.poem-scroll-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

#poetryTabContent .tab-pane.fade {
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: translateY(8px);
}

#poetryTabContent .tab-pane.fade.show {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  #poetryTabContent .tab-pane.fade {
    transition: none;
    transform: none;
  }
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

/* ---- Animations ---- */

/* Masthead entrance — container holds space, children animate within */
.masthead .container {
  min-height: 300px;
}

@media (min-width: 992px) {
  .masthead .container {
    min-height: 450px;
  }
}

/* Masthead entrance animations */
.masthead-heading {
  animation: fadeInUp 0.8s ease both;
  will-change: transform, opacity;
}

.masthead-avatar {
  animation: none;
}

.masthead-subheading {
  animation: fadeInUp 0.6s ease 0.4s both;
  will-change: transform, opacity;
}

.masthead .divider-custom {
  animation: fadeInUp 0.6s ease 0.5s both;
  will-change: transform, opacity;
}

/* Scroll-triggered fade in */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: transform, opacity;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

/* Staggered grid items */
.animate-stagger {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  will-change: transform, opacity;
}

.animate-stagger.is-visible {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

/* Hover effects */
.book-trigger {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.book-trigger:hover {
  transform: scale(1.03);
}

.photo-figure .photo-wrapper {
  transition: transform 0.25s ease;
}

.photo-figure:hover .photo-wrapper {
  transform: scale(1.02);
}

.archive-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.archive-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Navbar link transitions */
#mainNav .nav-link {
  transition: color 0.2s ease, opacity 0.2s ease;
}

/* Keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .masthead-heading,
  .masthead-avatar,
  .masthead-subheading,
  .masthead .divider-custom {
    animation: none;
  }

  .animate-on-scroll,
  .animate-stagger {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .book-trigger,
  .photo-figure .photo-wrapper,
  .archive-card {
    transition: none;
  }

  .book-trigger:hover {
    transform: none;
  }

  .photo-figure:hover .photo-wrapper {
    transform: none;
  }

  .archive-card:hover {
    transform: none;
  }
}

/* Mobile footer nav */
.mobile-footer-nav {
  display: none;
}

@media (max-width: 1199.98px) {
  .mobile-footer-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #2c3e50;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0;
    padding-bottom: calc(0.25rem + env(safe-area-inset-bottom));
  }

  .mobile-footer-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.65rem;
    transition: color 0.2s ease;
  }

  .mobile-footer-nav-item i {
    font-size: 1.1rem;
  }

  .mobile-footer-nav-item:hover,
  .mobile-footer-nav-item.active {
    color: #fff;
  }

  /* Prevent footer content from being hidden behind nav */
  body {
    padding-bottom: 3.5rem;
  }
}

/* Standardized news archive thumbnails */
.archive-thumb-wrapper {
  display: block;
  position: relative;
  overflow: hidden;
  padding-top: 60%; /* 5:3 aspect ratio */
  border-radius: 0.375rem 0.375rem 0 0;
}

.archive-thumb-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail {
  position: relative;
  overflow: hidden;
  
  /* Aspect Ratio 16:9 */
  padding-top: 56.25%;
}

.thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
