* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--card-bg-color, #ffffff);
    /* Changed from body-bg-color */
    color: var(--secondary-accent-color, rgb(125, 85, 73));
    /* Default to secondary for body text */
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: all 0.3s ease;
}

:root {
    --body-bg-color: #000000;
    --primary-text-color: rgb(93, 64, 55);
    --secondary-accent-color: rgb(125, 85, 73);
    --card-bg-color: #ffffff;
    --link-footer-bg-color: #f8f4f0;
    /* Add this new variable for top gradient */
    --top-gradient-start: rgb(93, 64, 55);
    --top-gradient-end: rgb(125, 85, 73);
}

.desktop-preview {
    width: 100%;
    max-width: 450px;
    height: 760px;
    background: var(--card-bg-color, #ffffff);
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(93, 64, 55, 0.2);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    body {
        padding: 0;
        background: var(--card-bg-color, white);
    }

    .desktop-preview {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
}

.profile-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.top-section {
    background: linear-gradient(135deg,
            var(--top-gradient-start, rgb(93, 64, 55)) 0%,
            var(--top-gradient-end, rgb(125, 85, 73)) 100%);
    padding: 0px 28px 50px;
    text-align: center;
    color: white;
    position: relative;
    flex-shrink: 0;
}

.crumb-heading {
    margin-bottom: 24px;
}

.crumb-heading h1 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.banner-wrapper {
    position: relative;           /* still good to keep */
    width: 100%;
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}
.sponsored-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.4px;
    z-index: 5;
    pointer-events: none;           /* doesn't block clicks on banner */
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);     /* nice modern touch if supported */
}
/* ──────────────────────────────────────────────── */
/*     NEW – no absolute positioning anymore        */
/* ──────────────────────────────────────────────── */

.profile-image-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 8px;           /* ← pulls image up a bit → overlaps slightly (recommended) */
    /* or use margin-top:  -50px / -40px / 0 — depending on how much overlap you want */
    /* or margin-top: 20px;   ← if you want ZERO overlap */
}

.profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    background: white;
}

/* Adjust the padding of the next section accordingly */
.profile-info {
    padding: 10px 14px 10px; /* ← was 50px, now less because no big overlap */
    text-align: center;
    background: var(--card-bg-color, white);
}

.profile-name {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    
    /* Emphasis for heading */
}

.profile-bio {
    font-size: 17px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    /* Softer for bio */
    margin: 0 auto 5px;
    line-height: 1.5;
    max-width: 320px;
    opacity: 0.85;
    /* Slightly softer */
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 10px 0;
    flex-wrap: wrap;
    margin-bottom: -10px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-text-color, rgb(93, 64, 55));
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-icon:hover {
    color: var(--primary-text-color, rgb(93, 64, 55));
    transform: translateY(-2px);
}

.social-link-icon {
    margin-right: 12px;
    font-size: 30px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.profile-content {
    padding: 0 24px 6px;
    background: var(--card-bg-color, white);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.desktop-preview {
    overflow-y: auto;
}


/* Hierarchy enhancements */
.section-title,
.modal-title {
    color: var(--primary-text-color, rgb(93, 64, 55));
    /* Strong for titles/headings */
}

.link-text,
/* Add .link-text class to your link elements in HTML/JS if not present */
.no-results,
.loading p,
.footer p,
.modal-description {
    color: var(--secondary-accent-color, rgb(125, 85, 73));
    /* Softer for supporting text */
}

.search-input::placeholder {
    color: color-mix(in srgb, var(--secondary-accent-color, rgb(125, 85, 73)) 60%, transparent);
    /* Subtle placeholder */
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--secondary-accent-color, rgb(125, 85, 73));
    /* Match secondary */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.search-container {
    position: sticky;
    top: 0;
    background: var(--card-bg-color, white);
    padding: 15px 0 12px;
    z-index: 5;
    margin-bottom: 10px;
    backdrop-filter: blur(8px);
    /* subtle glass effect on dark themes */
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: auto;
    right: 16px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    font-size: 16px;
    z-index: 2;
}

/* SEARCH INPUT – fully dynamic, matches card background + dynamic focus ring */
.search-input {
    width: 100%;
    padding: 14px 45px 14px 15px;
    border: 1.5px solid color-mix(in srgb, var(--primary-text-color) 12%, transparent);
    border-radius: 12px;
    font-size: 16px;

    background-color: var(--card-bg-color, #ffffff);
    color: var(--primary-text-color, rgb(93, 64, 55));     /* ← Changed to primary */

    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    text-align: left;
}

.search-input::placeholder {
    color: color-mix(in srgb, var(--primary-text-color, rgb(93, 64, 55)) 55%, transparent);
    opacity: 1;
    text-align: left;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-text-color);
    background-color: var(--card-bg-color, #ffffff);
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--primary-text-color) 18%, transparent),
        0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.clear-search {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--primary-text-color, rgb(93, 64, 55));
    font-size: 16px;
    cursor: pointer;
    display: none;
    z-index: 2;
    transition: all 0.3s ease;
    display: none;
}

.clear-search:hover {
    color: var(--secondary-accent-color, rgb(125, 85, 73));
}

.clear-search.visible {
    display: none;

}

.links-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-grow: 1;
    margin-top: 6px;
}

/* REPLACE your current .profile-link block with this entire section */

.profile-link {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 18px;
    background: var(--link-footer-bg-color, #f8f4f0); /* SOLID */
    border-radius: 12px;
    text-decoration: none;
    color: var(--primary-text-color);
    border: 1.5px solid color-mix(in srgb, var(--primary-text-color) 12%, transparent);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Minimal, no movement, no color change */
.profile-link:hover {
    background: color-mix(
        in srgb,
        var(--link-footer-bg-color) 88%,
        var(--primary-text-color) 12%
    );
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    transform: none; /* prevent jump in list view */
}
.profile-link::before {
    display: none !important;
}






.link-image {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

.link-icon {
    margin-right: 12px;
    font-size: 18px;
    color: var(--secondary-accent-color, rgb(125, 85, 73));
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== FIX: LIST VIEW IMAGE + ICON ALIGNMENT (DO NOT APPLY TO GRID) ===== */
.links-container:not(.grid-view) .link-image,
.links-container:not(.grid-view) .link-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}



.link-text {
    position: absolute;
    left: 50%;
    top: 50%;
    /* ADDED */
    transform: translate(-50%, -50%);
    /* UPDATED */
    width: 60%;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    pointer-events: none;
}
/* Truncate link names to 2 lines in LIST view (with ellipsis) */
.links-container:not(.grid-view) .profile-link .link-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word; /* Helps with very long single words */
}
/* Override the global .link-text so Grid View can control positioning */
.links-container.grid-view .link-text {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    color: var(--secondary-accent-color) !important;
}



.share-button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--secondary-accent-color);
    opacity: 0.9;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 5;                          /* Lower than search bar */
    pointer-events: none;                /* Start hidden / non-clickable */
                              /* Invisible by default */
}

/* Show share button ONLY on hover/tap/focus */
.profile-link:hover .share-button,
.profile-link:active .share-button,
.profile-link:focus-within .share-button {
    opacity: 1;
    pointer-events: auto;
}

/* Hover/active effect (scale + full opacity) */
.profile-link:hover .share-button,
.profile-link:active .share-button {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    background: rgba(125, 85, 73, 0.1);
}

/* Keep your list-view hover fix */
.links-container:not(.grid-view) .share-button:hover {
    transform: translateY(-50%) scale(1.1);
}
/* Make sure search bar is always on top of share buttons */
.search-container {
    z-index: 100 !important;             /* Higher than share button's z-index: 5 */
    background: var(--card-bg-color, white);
  
}


.share-button:hover {
    background: rgba(125, 85, 73, 0.1);
    opacity: 1;
    transform: scale(1.1);
}
/* FIX: prevent share button jumping in list view */
.links-container:not(.grid-view) .share-button:hover {
    transform: translateY(-50%) scale(1.1);
}


.no-results {
    text-align: center;
    padding: 20px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    font-style: normal;
    display: none;
    font-size: 16px;
}

.footer {
    padding: 16px 24px;
    text-align: center;
    font-size: 12px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    border-top: 1px solid #f1ece5;
    background-color: var(--link-footer-bg-color, #f8f4f0);
    flex-shrink: 0;
}

.footer a {
    color: var(--secondary-accent-color, rgb(125, 85, 73));
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--primary-text-color, rgb(93, 64, 55));
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-text-color, rgb(93, 64, 55));
    margin: 15px 0 8px;
    padding: 0;
    display: none;
    font-family: 'Playfair Display', serif;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 16px;
    padding-right: 0;
    /* Remove old hack */
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-text-color, rgb(93, 64, 55));
    font-family: 'Playfair Display', serif;
    margin: 0;
    flex: 1;
    text-align: center;
}

.modal-description {
    font-size: 16px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-button {
    background: var(--primary-text-color, rgb(93, 64, 55));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.modal-button:hover {
    background: var(--secondary-accent-color, rgb(125, 85, 73));
    transform: translateY(-2px);
}

.close-modal {
    position: absolute;
    top: 0;
    right: 0;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 22px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
    margin-top: -4px;
    display: none;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.1);
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-text-color, rgb(93, 64, 55));
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1001;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.capsule-popup {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(
        135deg,
        var(--top-gradient-start, rgb(93, 64, 55)) 0%,
        var(--top-gradient-end, rgb(125, 85, 73)) 100%
    );
    color: white;
    border-radius: 24px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(93, 64, 55, 0.3);
    z-index: 100;
    max-width: 200px;
    cursor: pointer;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateX(-50%) translateY(0px);
    }

    50% {
        transform: translateX(-50%) translateY(-5px);
    }

    100% {
        transform: translateX(-50%) translateY(0px);
    }
}

.capsule-text {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
}

.close-capsule {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 12px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 8px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.close-capsule:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.capsule-popup.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--primary-text-color, rgb(93, 64, 55));
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-text-color, rgb(93, 64, 55));
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .top-section {
        padding: 16px 20px 60px;
    }

    .crumb-heading {
        margin-bottom: 20px;
    }

    .crumb-heading h1 {
        font-size: 18px;
    }

    .profile-info {
        padding: 10px 14px 10px; 
    }

    .profile-content {
        padding: 0 20px 16px;
    }

    .capsule-popup {
        position: fixed;
        bottom: 10px;
        max-width: 180px;
    }

    .modal-content {
        width: 85%;
        margin: 20px;
    }

    .social-icons {
        gap: 10px;
        margin-bottom: -5px;
    }

    .social-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

.modal-image {
    display: none;
}

.modal-description {
    font-size: 16px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    margin-bottom: 24px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 8px;
}

.modal-description a {
    color: var(--primary-text-color, rgb(93, 64, 55));
    text-decoration: underline;
    font-weight: 600;
    word-break: break-all;
}

.modal-description a:hover {
    opacity: 0.8;
}

/* ===== VIEW TOGGLE BUTTON ===== */
.view-toggle-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    padding: 0 4px;
}

.view-toggle-btn {
    background: var(--card-bg-color, #ffffff);
    border: 1.5px solid color-mix(in srgb, var(--primary-text-color) 20%, transparent);
    border-radius: 8px;
    color: var(--primary-text-color, rgb(93, 64, 55));
    cursor: pointer;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    margin-left: auto;
}

.view-toggle-btn:hover {
    background: color-mix(in srgb, var(--primary-text-color) 8%, transparent);
    transform: translateY(+2px);
}

.view-toggle-btn.active {
    background: var(--primary-text-color, rgb(93, 64, 55));
    color: white;
    border-color: var(--primary-text-color, rgb(93, 64, 55));
}

/* ===== UPDATED GRID VIEW STYLES - CLEAN SEPARATION LIKE IMAGE ===== */
.links-container.grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 12px;
    row-gap: 16px;
    align-items: stretch;
    align-content: start;
}

.links-container.grid-view .profile-link {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1.3;
    border-radius: 12px;
    overflow: hidden !important; /* CRITICAL: This keeps everything inside */
    background: var(--link-footer-bg-color, #f8f4f0);
    border: 1.5px solid color-mix(in srgb, var(--primary-text-color) 12%, transparent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Image section - clean top portion */
.links-container.grid-view .link-content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.links-container.grid-view .link-image-container {
    width: 100%;
    height: 75%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--link-footer-bg-color, #f8f4f0);
    overflow: hidden;
    padding: 16px;
    transition: all 0.3s ease;
    position: relative; /* Add this to contain the share button */
}
.links-container.grid-view .link-image-container > * {
    position: static !important;
}


/* Make sure the image itself is centered */
.links-container.grid-view img.link-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    pointer-events: none;
    margin: 0 auto; /* Ensure centering */
    display: block;
}

/* Cards without images - HIDE the image container and make text take full height */
.links-container.grid-view .profile-link:not(.has-image) .link-image-container {
    display: none !important; /* Hide the image container completely */
}

.links-container.grid-view .profile-link:not(.has-image) .link-text-container {
    width: 100%;
    height: 100% !important; /* Text takes 100% of card */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 15px;
    text-align: center;
    background: var(--link-footer-bg-color, #f8f4f0);
    border-top: none !important; /* Remove the border top separator */
    border: none !important;
}

.links-container.grid-view .profile-link:not(.has-image) .link-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-text-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Allow 3 lines for cards without images */
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin: 0;
    padding: 0;
    max-height: 4.2em; /* 3 lines × 1.4em */
}

/* Cards WITH images - normal text section */
.links-container.grid-view .profile-link.has-image .link-text-container {
    width: 100%;
    height: 25%; /* Text takes 35% of card */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px 10px 14px;
    text-align: center;
    background: var(--link-footer-bg-color, #f8f4f0); /* Same as card */
    border-top: 1px solid color-mix(in srgb, var(--primary-text-color) 8%, transparent);
    transition: all 0.3s ease; /* Smooth transition */
}

.links-container.grid-view .profile-link.has-image .link-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-text-color);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin: 0;
    padding: 0;
    max-height: 2.6em;
}

/* GRID VIEW HOVER - SAME AS LIST VIEW */
.links-container.grid-view .profile-link:hover {
    background: color-mix(
        in srgb,
        var(--link-footer-bg-color) 88%,
        var(--primary-text-color) 12%
    );
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    transform: none; /* Same as list view */
}

/* Also update the image and text containers on hover */
.links-container.grid-view .profile-link:hover .link-image-container,
.links-container.grid-view .profile-link:hover .link-text-container {
    background: color-mix(
        in srgb,
        var(--link-footer-bg-color) 88%,
        var(--primary-text-color) 12%
    );
}

.links-container.grid-view .share-button {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    font-size: 14px;
    opacity: 0.5;
    color: var(--primary-text-color);
    transition: all 0.3s ease;
    transform: none;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.links-container.grid-view .share-button:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.1);
}


/* Ensure share button stays inside the card boundaries */
.links-container.grid-view .profile-link {
    position: relative;
    overflow: hidden !important;
}

.links-container.grid-view .share-button i {
    font-size: 14px;
    color: inherit;
}

/* Hide list-only icons in grid */
.links-container.grid-view .link-icon:not(.link-image-container .link-icon) {
    display: none !important;
}

/* Hide section titles adjacent to grid */
.links-container.grid-view ~ .section-title {
    display: none !important;
}

/* Fix for search highlight in grid view */
.links-container.grid-view .link-text mark {
    padding: 0 3px;
    line-height: inherit;
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Responsive tweaks */
@media (max-width: 480px) {
    .links-container.grid-view {
        column-gap: 8px;
        row-gap: 12px;
    }
    
    .links-container.grid-view .profile-link {
        aspect-ratio: 1 / 1.25;
    }
    
    .links-container.grid-view .link-image-container {
        height: 75%;
        padding: 12px;
    }
    
    .links-container.grid-view .profile-link.has-image .link-text-container {
        height: 25%;
        padding: 6px 4px 8px;
    }
    
    .links-container.grid-view .profile-link:not(.has-image) .link-text-container {
        padding: 15px 10px;
    }
    
    .links-container.grid-view .profile-link.has-image .link-text {
        font-size: 12px;
        line-height: 1.2;
    }
    
    .links-container.grid-view .profile-link:not(.has-image) .link-text {
        font-size: 14px;
        line-height: 1.3;
        -webkit-line-clamp: 2; /* 2 lines on mobile */
        line-clamp: 2;
        max-height: 2.6em;
    }
    
    .links-container.grid-view .share-button {
        width: 26px;
        height: 26px;
        top: 6px;
        right: 6px;
    }
}

/* Ensure anchor is clickable */
.links-container.grid-view .profile-link,
.links-container.grid-view .profile-link > a {
    pointer-events: auto;
}
.view-all-container {
    padding: 0 20px;
    margin: 4px 0 60px !important;     /* small top gap, enough bottom for capsule */
    text-align: center;
}

/* Mobile: very aggressive pull-up */
@media (max-width: 768px) {
    .view-all-container {
        margin: 4px 0 80px !important;   /* negative top = removes almost all gap */
        padding: 0 16px;
    }
}

.view-all-button {
    display: inline-block;
    background: var(--link-footer-bg-color, #f8f4f0);
    color: var(--secondary-accent-color, rgb(125, 85, 73));
    padding: 8px 18px;          /* slightly increased padding for better touch target */
    border-radius: 12px;
    font-size: 15px;             /* slightly smaller to feel more integrated */
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(93, 64, 55, 0.12); /* softer shadow to match light bg */
    border: 1.5px solid color-mix(in srgb, var(--secondary-accent-color) 30%, transparent);
}

.view-all-button:hover {
    background: color-mix(in srgb, var(--link-footer-bg-color) 85%, var(--secondary-accent-color) 15%);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(93, 64, 55, 0.18);
    border-color: var(--secondary-accent-color);
}
