/* ═══════════════════════════════════════════════
   MileMark Directory — v2.0
   Professional Legal Directory Design
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

:root {
    --mm-navy:       #1a2744;
    --mm-navy-light: #2a3a5c;
    --mm-gold:       #c9a84c;
    --mm-gold-light: #dfc06e;
    --mm-cream:      #faf8f3;
    --mm-white:      #ffffff;
    --mm-text:       #2c3e50;
    --mm-text-light: #6b7c93;
    --mm-border:     #e2e0db;
    --mm-shadow:     0 2px 8px rgba(26,39,68,0.08);
    --mm-shadow-lg:  0 8px 30px rgba(26,39,68,0.12);
    --mm-radius:     6px;
    --mm-font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --mm-font-body:    'Source Sans 3', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── RESET for plugin scope ── */
.mm-directory-wrapper *,
.mm-single-wrapper *,
.mm-directory-grid *,
.mm-table-grid * {
    box-sizing: border-box;
}

/* ── THEME CONTAINER BREAKOUT ──
   Forces directory pages to use full width regardless of theme.
   Targets GeneratePress, Astra, Kadence, and generic themes.
   Uses !important sparingly — only on theme containers, not our own elements. */

/* The outermost theme wrappers that constrain width */
.post-type-archive-mm_listing #page,
.post-type-archive-mm_listing .site,
.tax-mm_category #page,
.tax-mm_category .site,
.single-mm_listing #page,
.single-mm_listing .site {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.post-type-archive-mm_listing #content,
.post-type-archive-mm_listing .site-content,
.tax-mm_category #content,
.tax-mm_category .site-content,
.single-mm_listing #content,
.single-mm_listing .site-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* GeneratePress specific: .grid-container, .inside-article, .separate-containers */
.post-type-archive-mm_listing .grid-container,
.post-type-archive-mm_listing .inside-article,
.post-type-archive-mm_listing .content-area,
.post-type-archive-mm_listing #primary,
.tax-mm_category .grid-container,
.tax-mm_category .inside-article,
.tax-mm_category .content-area,
.tax-mm_category #primary,
.single-mm_listing .grid-container,
.single-mm_listing .inside-article,
.single-mm_listing .content-area,
.single-mm_listing #primary {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* GP separate containers: remove card styling on article wrapper */
.post-type-archive-mm_listing .separate-containers .inside-article,
.post-type-archive-mm_listing .separate-containers .site-main > article,
.tax-mm_category .separate-containers .inside-article,
.tax-mm_category .separate-containers .site-main > article,
.single-mm_listing .separate-containers .inside-article,
.single-mm_listing .separate-containers .site-main > article {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Hide theme sidebars on directory pages */
.post-type-archive-mm_listing #secondary,
.post-type-archive-mm_listing .is-right-sidebar,
.post-type-archive-mm_listing .is-left-sidebar,
.post-type-archive-mm_listing .sidebar,
.tax-mm_category #secondary,
.tax-mm_category .is-right-sidebar,
.tax-mm_category .is-left-sidebar,
.single-mm_listing #secondary,
.single-mm_listing .is-right-sidebar,
.single-mm_listing .is-left-sidebar {
    display: none !important;
}

/* GP: make content area full width when sidebar is hidden */
.post-type-archive-mm_listing .site-content .content-area,
.tax-mm_category .site-content .content-area,
.single-mm_listing .site-content .content-area {
    width: 100% !important;
}

/* Astra specific */
.post-type-archive-mm_listing .ast-container,
.tax-mm_category .ast-container,
.single-mm_listing .ast-container {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Kadence specific */
.post-type-archive-mm_listing .content-container,
.tax-mm_category .content-container,
.single-mm_listing .content-container {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ═══════════════════════════════════════════════
   ARCHIVE PAGE
   ═══════════════════════════════════════════════ */

.mm-directory-wrapper {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 24px 60px;
    font-family: var(--mm-font-body);
    color: var(--mm-text);
}

/* ── Hero Header ── */
.mm-directory-header {
    background: linear-gradient(135deg, var(--mm-navy) 0%, var(--mm-navy-light) 100%);
    margin: 0 -24px 48px;
    padding: 56px 40px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.mm-directory-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 1;
}

.mm-directory-header h1 {
    font-family: var(--mm-font-display);
    font-size: 2.6em;
    font-weight: 700;
    color: var(--mm-white);
    margin: 0 0 12px;
    position: relative;
    letter-spacing: -0.02em;
}

.mm-directory-header p {
    color: rgba(255,255,255,0.7);
    font-size: 1.15em;
    font-weight: 300;
    margin: 0;
    position: relative;
    letter-spacing: 0.01em;
}

.mm-directory-header h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--mm-gold);
    margin: 16px auto 0;
    border-radius: 2px;
}

/* ── Layout ── */
.mm-directory-content {
    display: flex;
    gap: 48px;
    align-items: flex-start;
}

/* ── Sidebar ── */
.mm-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 32px;
    background: var(--mm-white);
    border: 1px solid var(--mm-border);
    border-radius: var(--mm-radius);
    padding: 24px;
    box-shadow: var(--mm-shadow);
}

.mm-sidebar h4 {
    font-family: var(--mm-font-display);
    font-size: 1.05em;
    font-weight: 700;
    color: var(--mm-navy);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--mm-gold);
}

.mm-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mm-sidebar li {
    margin-bottom: 0;
}

.mm-sidebar li a {
    display: block;
    padding: 9px 12px;
    color: var(--mm-text);
    text-decoration: none;
    font-size: 0.92em;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.mm-sidebar li a:hover {
    background: var(--mm-cream);
    color: var(--mm-navy);
    text-decoration: none;
    padding-left: 16px;
}

.mm-listings {
    flex: 1;
    min-width: 0;
}

/* ═══════════════════════════════════════════════
   DIRECTORY CARD GRID  (archive + shortcode)
   ═══════════════════════════════════════════════ */

.mm-directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.mm-listing-card {
    background: var(--mm-white);
    border: 1px solid var(--mm-border);
    border-radius: var(--mm-radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.mm-listing-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--mm-shadow-lg);
}

/* Card image area */
.mm-card-image,
.mm-listing-card > a:first-child {
    display: block;
    position: relative;
    overflow: hidden;
}

.mm-card-image img,
.mm-listing-card > a:first-child > img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.mm-listing-card:hover .mm-card-image img,
.mm-listing-card:hover > a:first-child > img {
    transform: scale(1.04);
}

.mm-placeholder-img {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--mm-navy) 0%, var(--mm-navy-light) 60%, var(--mm-gold) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 20px;
    text-align: center;
}

.mm-placeholder-name {
    color: rgba(255,255,255,0.95);
    font-family: var(--mm-font-display);
    font-size: 1.1em;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    max-width: 90%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mm-placeholder-icon {
    font-size: 28px;
    opacity: 0.3;
    color: white;
    line-height: 1;
}

.mm-placeholder-img.large {
    height: 300px;
    gap: 10px;
}

.mm-placeholder-img.large .mm-placeholder-name {
    font-size: 1.6em;
}

.mm-placeholder-img.large .mm-placeholder-icon {
    font-size: 42px;
}

/* Card content */
.mm-card-content {
    padding: 18px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mm-listing-card h3 {
    margin: 0 0 8px;
    font-family: var(--mm-font-display);
    font-size: 1.05em;
    font-weight: 700;
    line-height: 1.3;
}

.mm-listing-card h3 a {
    color: var(--mm-navy);
    text-decoration: none;
    transition: color 0.15s ease;
}

.mm-listing-card h3 a:hover {
    color: var(--mm-gold);
}

.mm-category {
    font-size: 0.8em;
    color: var(--mm-text-light);
    margin: 0 0 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mm-category a {
    color: var(--mm-gold);
    text-decoration: none;
    font-weight: 600;
}

.mm-category a:hover {
    text-decoration: underline;
}

.mm-website {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--mm-border);
}

.mm-website a {
    color: var(--mm-navy);
    text-decoration: none;
    font-size: 0.88em;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.15s ease;
}

.mm-website a::before {
    content: '→';
    font-size: 0.9em;
    transition: transform 0.15s ease;
}

.mm-website a:hover {
    color: var(--mm-gold);
}

.mm-website a:hover::before {
    transform: translateX(3px);
}

/* ── Pagination ── */
.mm-pagination {
    margin-top: 48px;
    text-align: center;
}

.mm-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.mm-pagination a,
.mm-pagination span {
    padding: 10px 16px;
    border: 1px solid var(--mm-border);
    border-radius: var(--mm-radius);
    text-decoration: none;
    color: var(--mm-text);
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.15s ease;
    font-family: var(--mm-font-body);
}

.mm-pagination a:hover {
    background: var(--mm-cream);
    border-color: var(--mm-gold);
    color: var(--mm-navy);
}

.mm-pagination .current {
    background: var(--mm-navy);
    color: var(--mm-white);
    border-color: var(--mm-navy);
}

/* ═══════════════════════════════════════════════
   SINGLE LISTING PAGE
   ═══════════════════════════════════════════════ */

.mm-single-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    font-family: var(--mm-font-body);
    color: var(--mm-text);
}

.mm-single-header {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.mm-single-header h1 {
    font-family: var(--mm-font-display);
    font-size: 2.1em;
    font-weight: 700;
    color: var(--mm-navy);
    margin: 0;
    letter-spacing: -0.01em;
}

.mm-back-link {
    color: var(--mm-text-light);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid var(--mm-border);
    border-radius: var(--mm-radius);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.mm-back-link:hover {
    background: var(--mm-cream);
    border-color: var(--mm-gold);
    color: var(--mm-navy);
    text-decoration: none;
}

.mm-single-content {
    display: flex;
    gap: 40px;
    background: var(--mm-white);
    border: 1px solid var(--mm-border);
    border-radius: var(--mm-radius);
    padding: 32px;
    box-shadow: var(--mm-shadow);
}

.mm-single-image {
    width: 280px;
    flex-shrink: 0;
}

.mm-single-image img {
    width: 100%;
    height: auto;
    border-radius: var(--mm-radius);
    border: 1px solid var(--mm-border);
}

.mm-listing-title {
    font-family: var(--mm-font-display);
    font-weight: 700;
    font-size: 1.05em;
    margin-top: 16px;
    color: var(--mm-navy);
}

.mm-single-details {
    flex: 1;
}

.mm-single-details h4 {
    font-family: var(--mm-font-display);
    font-size: 1em;
    font-weight: 700;
    color: var(--mm-navy);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--mm-gold);
}

.mm-description {
    line-height: 1.75;
    color: var(--mm-text);
    margin-bottom: 28px;
    font-size: 0.98em;
}

.mm-contact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mm-contact li {
    margin-bottom: 10px;
}

.mm-contact a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--mm-navy);
    color: var(--mm-white);
    text-decoration: none;
    border-radius: var(--mm-radius);
    font-weight: 600;
    font-size: 0.92em;
    transition: all 0.2s ease;
}

.mm-contact a:hover {
    background: var(--mm-gold);
    color: var(--mm-navy);
    text-decoration: none;
}

.mm-contact a::before {
    content: '🌐';
    font-size: 0.9em;
}

/* ═══════════════════════════════════════════════
   TABLE / COMPACT GRID SHORTCODE
   ═══════════════════════════════════════════════ */

.mm-table-grid {
    display: grid;
    gap: 1px;
    background: var(--mm-border);
    border: 1px solid var(--mm-border);
    border-radius: var(--mm-radius);
    overflow: hidden;
    font-family: var(--mm-font-body);
}

.mm-table-cell {
    background: var(--mm-white);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 68px;
    transition: background 0.15s ease;
}

.mm-table-cell:hover {
    background: var(--mm-cream);
}

.mm-table-cell a.mm-cell-name {
    color: var(--mm-navy);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88em;
    line-height: 1.3;
    transition: color 0.15s ease;
}

.mm-table-cell a.mm-cell-name:hover {
    color: var(--mm-gold);
    text-decoration: none;
}

.mm-table-cell .mm-cell-meta {
    font-size: 0.7em;
    color: var(--mm-gold);
    margin-top: 4px;
    line-height: 1.2;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mm-table-cell .mm-cell-link {
    font-size: 0.72em;
    margin-top: 5px;
}

.mm-table-cell .mm-cell-link a {
    color: var(--mm-text-light);
    text-decoration: none;
    transition: color 0.15s ease;
}

.mm-table-cell .mm-cell-link a:hover {
    color: var(--mm-gold);
}

/* ═══════════════════════════════════════════════
   SHORTCODE CARD GRID (when used in pages)
   Extra specificity for inside page content
   ═══════════════════════════════════════════════ */

.entry-content .mm-directory-grid,
.page-content .mm-directory-grid,
.post-content .mm-directory-grid {
    margin: 24px 0;
}

.entry-content .mm-listing-card,
.page-content .mm-listing-card {
    border: 1px solid var(--mm-border);
}

/* Shortcode cards without image — text-only compact style */
.mm-listing-card > a:first-child:empty + h3,
.mm-listing-card h3:first-child {
    padding-top: 4px;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 900px) {
    .mm-directory-content {
        flex-direction: column;
    }
    
    .mm-sidebar {
        width: 100%;
        position: static;
    }
    
    .mm-sidebar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .mm-sidebar li a {
        padding: 6px 12px;
        background: var(--mm-cream);
        border-radius: 20px;
        font-size: 0.85em;
    }
    
    .mm-table-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .mm-directory-header {
        padding: 40px 24px 36px;
    }
    
    .mm-directory-header h1 {
        font-size: 1.8em;
    }
    
    .mm-single-content {
        flex-direction: column;
        padding: 24px;
    }
    
    .mm-single-image {
        width: 100%;
    }
    
    .mm-single-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mm-single-header h1 {
        font-size: 1.6em;
    }
    
    .mm-directory-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 600px) {
    .mm-directory-grid {
        grid-template-columns: 1fr;
    }
    
    .mm-table-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .mm-directory-wrapper {
        padding: 0 16px 40px;
    }
    
    .mm-directory-header {
        margin: 0 -16px 32px;
        padding: 32px 20px 28px;
    }
}
