/*!
 * Copyright (c) 2025 Kenneth Raymond
 * All rights reserved.
 *
 * Part of the expertsincmt WordPress theme.
 *
 * ------------------------------------------------------------
 * SECTION — The Dorsal Root (3-wide featured teaser)
 * ------------------------------------------------------------
 * Styles for the [dorsal_root_section] shortcode
 * (templates/parts/section-dorsal-root.php), deployed above the
 * footer across the platform. Uses its own `dr-feature` namespace
 * so it is fully decoupled from the loop/card `.dr-*` classes.
 *
 * Scope: .dr-feature
 */

.dr-feature {
  margin-top: 2.5rem;
  margin-bottom: 100px;
}

.dr-feature__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dr-feature__title {
  margin: 0;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.75rem);
  color: #174777;
}

.dr-feature__more {
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #174777;
  color: #174777;
  border-radius: 12px;
  padding: 0.5rem 0.9rem;
  display: inline-flex;
  align-items: center;
  line-height: 1.1;
  background: transparent;
  text-transform: uppercase;
  font-size: 0.9rem;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}

.dr-feature__more:hover,
.dr-feature__more:focus-visible {
  outline: none;
  background-color: #174777;
  color: #fff;
  border-color: #174777;
}

/* Exempt from the global underline-on-hover rule */
.dr-feature__more,
.dr-feature__more:hover,
.dr-feature__more:focus,
.dr-feature__more:focus-visible {
  text-decoration: none !important;
}

/* Mobile: collapse the header wrapper so title, cards, and button become
   one vertical stack, then reorder to title -> cards -> button. The desktop
   row (title left, button top-right) squeezed the title into three lines on
   a phone; this reads far better. (2026-07) */
@media (max-width: 600px) {
  .dr-feature {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 40px;
  }
  .dr-feature__head {
    display: contents;
  }
  .dr-feature__title {
    order: 0;
    /* !important escapes the global `body * { font-size: 18px !important }`
       mobile floor, which was flattening this heading to body size. */
    font-size: 1.5rem !important;
    line-height: 1.2 !important;
    margin: 0;
  }
  .dr-feature__grid {
    order: 1;
  }
  .dr-feature__more-wrap {
    order: 2;
    align-self: flex-start;
    display: block;
  }
  .dr-feature__more {
    display: inline-flex;
    width: auto;
  }
}

/* Grid: 1 / 2 / 3 columns */
.dr-feature__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 680px) {
  .dr-feature__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .dr-feature__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Tablet (2-column range): when the card count is odd, the last card is
   orphaned in the left slot with dead space beside it. Span it across both
   columns and re-center it at single-column width so it sits centered under
   the pair above. Below 680px it's a single column and at 1024px+ all three
   share one row, so neither needs this. (2026-07) */
@media (min-width: 680px) and (max-width: 1023px) {
  .dr-feature__card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc((100% - 1rem) / 2);
  }
}

/* Card */
.dr-feature__card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease;
}

.dr-feature__card:hover {
  background-color: #f8fafc;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  border-color: #dbe1e6;
}

/* Media: fixed 16:9 crop */
.dr-feature__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #f1f5f9;
  overflow: hidden;
  line-height: 0;
}

.dr-feature__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: transform 0.35s ease;
}

/* Cohesive hover: gentle image zoom paired with the card lift */
.dr-feature__card:hover .dr-feature__media img,
.dr-feature__card:focus-within .dr-feature__media img {
  transform: scale(1.04);
}

.dr-feature__media-ph {
  width: 100%;
  height: 100%;
  background: #e2e8f0;
  display: block;
}

/* Body */
.dr-feature__body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1rem 1.1rem;
}

.dr-feature__post-title {
  margin: 0;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
  font-weight: 500;
  line-height: 1.25;
}

.dr-feature__post-title a {
  color: var(--primary, #174777);
  text-decoration: none;
}

.dr-feature__post-title a:hover,
.dr-feature__post-title a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.dr-feature__excerpt {
  margin: 0.25rem 0 0;
  color: var(--muted, #555);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .dr-feature__card,
  .dr-feature__more,
  .dr-feature__media img {
    transition: none;
  }
}
