/* ========================
   CATEGORIES
======================== */
.categories { background: var(--bg-stone); }

.categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

.cat-card {
    display: block;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    aspect-ratio: 4 / 2.35;
    background: var(--sand);
    transition: transform var(--transition), box-shadow var(--transition);
}
.cat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.cat-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s ease;
}
.cat-card:hover .cat-img { transform: scale(1.05); }

.cat-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(30, 45, 37, 0.65) 0%, transparent 55%);
}

.cat-label {
    position: absolute;
    bottom: 1.1rem;
    left: 1.1rem;
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1;
}

.cat-card--cta {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-sand);
    border: 2px dashed var(--leaf);
    aspect-ratio: 4 / 2.35;
}
.cat-cta-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--forest);
    font-size: 0.88rem;
    font-weight: 500;
    transition: gap var(--transition);
}
.cat-card--cta:hover .cat-cta-inner { gap: 0.9rem; }



/* ========================
   PRACTITIONERS PREVIEW
======================== */
.practitioners { background: var(--bg-stone); }

.practitioners-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3rem;
}

.practitioner-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.practitioner-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}
.practitioner-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

/* --- Updated Practitioner Card Styles --- */

.practitioner-img {
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: top center; /* Headshots focus on face, prevents chopping at the brow */
    position: relative;
    overflow: hidden;
    width: 100%;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background-color: var(--bg-stone, #F5F5F4);
    transition: transform var(--transition);
}

.practitioner-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.practitioner-card:hover .practitioner-img { 
    transform: scale(1.03); 
}

.practitioner-info { 
    padding: 2rem; /* More generous breathing room */
}

/* This replaces .practitioner-tag */
.category-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
}

.tag-plum { background: var(--plum); }
.tag-gold { background: #d4af37; } /* Gold color for premium tier */
.tag-gray { background: var(--text-muted); } /* Gray for free tier */
.tag-sage { background: var(--leaf-deep); }

.practitioner-info p {
    font-size: 0.87rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}



/* ================================================
   PRACTITIONER GRID - NEW STYLES
   ================================================ */

.practitioners-grid,
.practitioner-grid {
    display: grid;
    /* Using auto-fill ensures empty columns remain as placeholders, preventing stretching */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
    width: 100%;
}

.practitioner-card {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-align: left;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid rgba(111, 148, 138, 0.1);
    position: relative; /* Necessary for absolute positioning of tags */
    max-width: 100%;
    margin: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- Dynamic Density Layouts for Grids --- */
/* Base grid for multiple items (3 or more) - this is often the default practitioner-grid behavior */
.practitioner-grid.layout-multi {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

/* Layout for 2 items */
.practitioner-grid.layout-pair {
    grid-template-columns: repeat(2, 1fr);
}

/* Layout for 1 item */
.practitioner-grid.layout-single {
    grid-template-columns: 1fr; /* Ensure it takes full width of its parent grid */
}

/* Styling for the card itself when it's the only item in a .layout-single grid */
.practitioner-grid.layout-single .practitioner-card {
    display: flex;
    flex-direction: row;        /* Landscape layout */
    align-items: stretch;       /* Stretch items to fill height */
    width: 100%;                /* Take full width of its grid column */
    max-width: 700px;           /* Limit single card width */
    margin: 0 auto;             /* Center the single card */
}

.practitioner-grid.layout-single .practitioner-card .practitioner-img {
    flex: 0 0 40%;              /* Image takes 40% width */
    aspect-ratio: unset;        /* Remove fixed aspect ratio */
    height: auto;               /* Allow height to adjust */
    min-height: 240px;          /* Ensure minimum height as requested */
    border-radius: var(--radius-md) 0 0 var(--radius-md); /* Rounded corners only on left */
    display: flex;              /* Enable flexbox for content alignment */
    flex-direction: column;     /* Stack content vertically */
    justify-content: center;    /* Center content vertically */    pointer-events: auto;       /* Re-enable pointer events for the image area in this specific layout */
    z-index: 1;                 /* Ensure it sits above the card-link */
}

.practitioner-grid.layout-single .practitioner-card .practitioner-info {
    flex: 1 1 60%; /* Info takes 60% width */
    padding: 1.5rem 2rem; /* Adjust padding */
}

/* Mobile responsiveness for dynamic layouts */
@media (max-width: 768px) {
    .practitioner-grid.layout-pair,
    .practitioner-grid.layout-multi {
        grid-template-columns: 1fr; /* Stack on smaller screens */
    }
    .practitioner-grid.layout-single .practitioner-card {
        flex-direction: column; /* Stack on mobile */
        max-width: 100%;
    }
    .practitioner-grid.layout-single .practitioner-card .practitioner-img {
        flex: 0 0 auto;
        aspect-ratio: 4 / 3; /* Restore aspect ratio for mobile */
        border-radius: var(--radius-md) var(--radius-md) 0 0; /* Rounded corners on top */
    }
}

/* --- NEW: Pill Action Button --- */
.btn-pill-action {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    font-weight: 500;
}
/* --- NEW: Card Load-in Animation --- */
@keyframes card-load-in {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.practitioner-card.is-loading {
    animation: card-load-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: calc(var(--card-index, 0) * 70ms);
}

.practitioner-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.practitioner-img {
    height: 220px; /* Reduces the towering height of the images */
    background-size: cover;
    background-position: top center;
    position: relative;
    pointer-events: none; /* Allow clicks to pass through to the underlying card-link */
}

.category-tag {
    display: inline-block; /* Change from absolute to inline-block */
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.8rem; /* Adds space so it doesn't touch the text below */
    z-index: 10;
}

.tag-plum { background: var(--plum); }
.tag-sage { background: var(--leaf-deep); }

.practitioner-info {
    padding: 1.8rem;
}

.practitioner-info h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    color: var(--ink);
    margin-bottom: 0.4rem;
}

.specialty {
    color: var(--leaf-deep);
    font-weight: 500;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.location {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.profile-link {
    text-decoration: none;
    color: var(--plum);
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity var(--transition);
}

.profile-link:hover {
    opacity: 0.8;
}

/* Extra breathing room for the transition between dark and light sections */
.extra-pad {
    padding-top: 8rem !important; /* Increases the gap at the top */
    padding-bottom: 8rem !important; /* Increases the gap at the bottom */
}

/* Optional: Add a very subtle divider line if you want even more definition */
.events-preview {
    border-top: 1px solid rgba(111, 148, 138, 0.1); 
}



/* ================================================
   MAGAZINE-STYLE CARD TYPOGRAPHY UPGRADE
================================================ */

/* 1. The Practitioner Name */
.practitioner-info h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.8rem;
    color: var(--ink);
    margin: 0.8rem 0 0.2rem 0; /* Tightens the gap below the tag */
    line-height: 1.1;
    font-weight: 400; /* Serifs often look more elegant without bolding */
}

/* 2. The Specialty Subtitle */
.practitioner-info .specialty {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #6E746F; /* A softer, muted grey */
    margin-bottom: 1rem;
    font-weight: 400;
}

/* 3. The Location Pin */
.practitioner-info .location {
    font-size: 0.85rem;
    color: var(--text-muted); /* Updated for AA contrast */
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #E8E2D6; /* Adds a subtle divider line */
    padding-bottom: 1rem;
}

/* 4. The 'View Profile' Link */
.practitioner-info .profile-link {
    display: inline-flex;
    align-items: center;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--plum); /* Uses your brand color */
    text-transform: uppercase;
    letter-spacing: 1.5px; /* Spaced out for that editorial look */
    text-decoration: none;
    transition: all 0.3s ease;
}

/* The Arrow */
.practitioner-info .profile-link span {
    margin-left: 8px;
    font-size: 1rem;
    transition: transform 0.3s ease;
}

/* Hover Effects! */
.practitioner-info .profile-link:hover {
    color: var(--ink); /* Darkens on hover */
}

.practitioner-info .profile-link:hover span {
    transform: translateX(6px); /* Arrow slides neatly to the right */
}



/* ==========================================================================
   THE HOLY GRAIL CARD LAYERING FIX
   ========================================================================== */
/* 1. Elevate the image container ABOVE the clickable card link (z-index 1) */
.practitioner-img {
    position: relative !important;
    z-index: 2 !important;
    pointer-events: none !important; /* Lets clicks on the empty photo fall through to the card link */
}

/* 2. Ensure the heart button inside it is clickable on layer 2 */
.favourite-btn {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 20 !important;
    pointer-events: auto !important; /* Re-enables clicking specifically on the heart */
    cursor: pointer !important;
}

.favourite-btn svg,
.favourite-btn svg * {
    pointer-events: none !important;
}

.favourite-btn.active svg,
.favourite-btn.saved svg {
    fill: #E11D48 !important;
    stroke: #E11D48 !important;
}

/* 3. Keep the full-card anchor link cleanly below layer 2 */
.card-link,
.card-image-link,
.card-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
    outline: none !important;
    pointer-events: auto !important;
}
