/* ==========================================================================
   Home Page Feature Grid (Top Navigation Cards)
   ========================================================================== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (max-width: 900px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem; /* Closer padding stack on mobile */
    }
}

.feature-card {
    text-decoration: none;
}

.feature-card-desc {
    display: block;
    padding: 0.35rem 0.75rem 0.75rem; /* Matches the lower frame grid padding bounds */
    font-size: 0.9rem;
    color: #64748b; /* Clean soft slate gray body */
    line-height: 1.5;
}

/* ==========================================================================
   Featured Content Cards (Editorial Lower Section)
   ========================================================================== */
.featured-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

@media (max-width: 480px) {
    .featured-content-grid {
        grid-template-columns: 1fr; /* Strict structural column rule for tiny viewports */
        gap: 1.5rem;
    }
}

.featured-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px; /* Clean rounded contour matching route directory look */
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform .2s ease, box-shadow .2s ease;
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(15, 45, 89, 0.08); /* Soft blue shadow tint */
}

.featured-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.featured-card-title {
    padding: 1.25rem 1rem 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f2d59; /* Updated to match Deep Interstate Blue */
}

.featured-card-desc {
    padding: 0 1rem 1.25rem;
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
}

.featured-card-link {
    display: inline-block;
    font-weight: 600;
    color: #0f2d59; /* Updated to match Deep Interstate Blue */
    text-decoration: none;
    margin-top: 0.5rem;
}

.featured-card-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   State & Route Family Layout Directories
   ========================================================================== */
.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.state-card {
    display: flex;
    /* This changes the alignment from horizontal to vertical */
    flex-direction: column; 
    /* Centers the image and text horizontally within the card */
    align-items: center; 
    /* Adds a clean gap between the image, name, and route count */
    gap: 0.5rem; 

    padding: 1rem 1.25rem;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    text-align: center; /* Centers the text alignment */

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

/* Add this to your CSS file */
.state-card-image {
    width: 100%;          /* Forces the image to span the width of the card */
    height: 120px;        /* Gives all thumbnails a uniform height */
    object-fit: cover;    /* Crops/scales the image nicely without stretching it */
    border-radius: 4px;   /* Optional: softens the image corners */
    display: block;       /* Removes unwanted bottom whitespace inherent to inline elements */
}

.state-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 4px 12px rgba(0,0,0,.08);
}

/* Forces the span to behave like a block element, pushing the next span to a new line */
.state-name {
    display: block; 
    font-weight: 600;
    margin-top: 0.5rem; /* Space between the image and the state name */
}

.route-count {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
}

.family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin: 2rem 0;
    padding: 0 10px;
}

.family-card-title {
    display: block;
    padding: 0.75rem 0.75rem 0 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
}

.family-card-count {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
}

.family-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

/* ==========================================================================
   Route Card Directories (state.php / category view)
   ========================================================================== */
.route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.route-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.route-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 45, 89, 0.08);
}

.route-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.route-card-title {
    display: block;
    padding: 0.75rem 0.75rem 0 0.75rem;
    font-weight: 700;
    color: #0f2d59; /* Updated to match Deep Interstate Blue */
    font-size: 1rem;
    line-height: 1.3;
}

.route-card-endpoints {
    display: block;
    padding: 0.35rem 0.75rem 0.75rem;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.4;
}

/* Optimize high-volume business route lists for mobile views */
@media (max-width: 576px) {
    .route-grid {
        /* Drop the grid behavior to eliminate tall vertical card stacks */
        display: flex;
        flex-direction: column;
        gap: 0.5rem; /* Tighter item spacing */
        margin-top: 1rem;
    }

    .route-card {
        display: flex;
        flex-direction: row; /* Align shield and text side-by-side */
        align-items: center;
        padding: 0.6rem 0.8rem;
        gap: 0.75rem;
        min-height: auto;
        border-radius: 6px;
    }

    .route-card-image {
        width: 36px;  /* Compact, uniform size for the highway shield */
        height: auto;
        margin: 0;
        flex-shrink: 0;
    }

    .route-card-title {
        font-size: 0.9rem;
        line-height: 1.2;
        margin: 0;
        flex-grow: 1; /* Pushes the status badge to the right if desired, or flows naturally */
    }

    /* Adjust inline status badge spacing for the new row layout */
    .route-card-status-badge {
        margin-top: 0 !important; /* Override the desktop block margin push */
        margin-left: auto; /* Cleanly docks the badge to the right edge of the row */
        font-size: 10px !important;
        padding: 1px 5px !important;
        white-space: nowrap;
    }
}

/* ==========================================================================
   Home Page Slider / Media Layouts (Sanitized & Validated)
   ========================================================================== */
.home-hero {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 7;
    min-height: auto; 
}

.hero-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
    width: 100%;
    height: 100%;
}

.hero-slide.active {
    opacity: 1;
}

.hero-slide video,
.hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;

    color: #fff;

    text-shadow:
        2px 2px 4px rgba(0,0,0,.8);
}

.hero-overlay h1 {
    margin: 0;
    font-size: 2.8rem;
    color: #fff;
}

/* =========================================================================
   RESPONSIVE OVERRIDES (Mobile Layout Constraints)
   ========================================================================= */
@media (max-width: 768px) {
    .home-hero {
        aspect-ratio: 4 / 3;
        min-height: auto;
    }
    .hero-overlay {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
    .hero-overlay h1 {
        font-size: 2rem;
    }
}

/* ==========================================================================
   Updates Page Directory Layouts
   ========================================================================== */
.catalog-updates-section, .recent-updates {
    margin: 40px 0;
}

.updates-grid {
    display: grid;
    gap: 25px;
}

/* 
   Set minmax bounds so columns stop stretching aggressively, 
   or limit the maximum width of card columns.
*/
.full-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 330px));
}

.recent-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 330px));
}

.update-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.update-item:hover {
    transform: translateY(-4px);
}

/* 
   Constrain the image container height and ensure 
   the image scales without distorting or exceeding native bounds.
*/
.update-image {
    background-color: #f8fafc;
    text-align: center;
    overflow: hidden;
}

.update-image img {
    width: 100%;
    max-width: 330px; /* Never scale past native 330px width */
    height: 220px;    /* Lock aspect ratio height */
    object-fit: cover; /* Crop cleanly if aspect ratio slightly varies */
    display: block;
    margin: 0 auto;
}

.update-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.route-marker {
    height: 35px;
    width: auto;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}

.update-content h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #0f2d59; /* Updated to match Deep Interstate Blue */
}

.update-content h3 a {
    text-decoration: none;
    color: inherit;
}

.update-content p {
    margin: 10px 0 8px 0;
    line-height: 1.5;
    color: #334155;
}

figcaption {
    padding: 0 1rem;
    color: #64748b;
    line-height: 1.5;
    flex-grow: 1;
}

/* ==========================================================================
   Business Shield Pill Button Actions
   ========================================================================== */
.biz-shield-button {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    text-decoration: none;
    color: #1e293b;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.biz-shield-button:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    color: #0f2d59; /* Updated to match Deep Interstate Blue on hover states */
}

.biz-button-icon {
    display: block;
    width: 35px;
    height: 35px;
    margin-right: 12px;
    flex-shrink: 0;
}

.biz-button-text {
    font-size: 0.95rem;
    line-height: 1.2;
}