/* 
 * Nutshell.js Custom Styles
 * Clean inline expandable definitions
 */

/* ===== EXPANDABLE LINKS ===== */
/* Nutshell converts links to spans with this class */
.nutshell-expandable {
    display: inline !important;
    cursor: pointer !important;
}

/* The text part of the expandable link */
.nutshell-expandable-text {
    background: rgba(45, 79, 60, 0.08) !important;
    color: var(--color-accent, #2D4F3C) !important;
    padding: 0.15em 0.5em !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    border-bottom: none !important;
}

.nutshell-expandable:hover .nutshell-expandable-text {
    background: rgba(45, 79, 60, 0.15) !important;
}

/* Hide the ball/arrow indicator */
.nutshell-ball-up,
.nutshell-ball-down {
    display: none !important;
}

/* ===== THE BUBBLE/POPUP ===== */
.nutshell-bubble {
    background: #ffffff !important;
    border: 1px solid #e8e4de !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(47, 24, 16, 0.12), 
                0 2px 8px rgba(47, 24, 16, 0.08) !important;
    padding: 0 !important;
    font-family: 'Source Sans 3', system-ui, sans-serif !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    color: #2F1810 !important;
    max-width: 420px !important;
    min-width: 280px !important;
    margin-top: 8px !important;
    overflow: hidden !important;
    animation: nutshellFadeIn 0.2s ease-out !important;
}

.nutshell-bubble::before {
    display: none !important;
}

/* Hide the "from URL" line */
.nutshell-bubble-from,
p.nutshell-bubble-from,
.nutshell-bubble-overflow .nutshell-bubble-from,
.nutshell-bubble-overflow > p:first-child {
    display: none !important;
}

/* Content container */
.nutshell-bubble-overflow {
    padding: 1rem 1.25rem !important;
}

/* Definition title inside bubble */
.nutshell-bubble h1,
.nutshell-bubble h2,
.nutshell-bubble h3,
.nutshell-bubble-overflow h1,
.nutshell-bubble-overflow h2,
.nutshell-bubble-overflow h3 {
    display: none !important; /* Hide the heading, just show content */
}

/* Content paragraphs */
.nutshell-bubble p,
.nutshell-bubble-overflow p {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
}

.nutshell-bubble-overflow > p:first-of-type {
    margin-top: 0 !important;
}

.nutshell-bubble strong {
    color: #2F1810;
    font-weight: 700;
}

/* ===== CLOSE BUTTON ===== */
.nutshell-bubble-overflow-close,
.nutshell-bubble .nutshell-close,
.nutshell-bubble button[onclick*="close"] {
    position: absolute !important;
    top: 0.5rem !important;
    right: 0.5rem !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: rgba(0,0,0,0.06) !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #666 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    line-height: 1 !important;
    z-index: 10 !important;
}

.nutshell-bubble-overflow-close:hover,
.nutshell-bubble .nutshell-close:hover,
.nutshell-bubble button:hover {
    background: rgba(0,0,0,0.12) !important;
    color: #333 !important;
}

/* ===== HIDE EMBED BUTTON ===== */
.nutshell-bubble-overflow-embed-button {
    display: none !important;
}

/* ===== HIDE EMBED TUTORIAL MODAL ===== */
.nutshell-embed-info,
[class*="nutshell-embed"],
.nutshell-bubble footer,
.nutshell-bubble .embed,
body > div:last-of-type:has(input[readonly]),
body > div:last-of-type:has([type="text"]),
div[style*="position: fixed"]:has(input),
body > div:not([class]):not([id]):has(input[value*="nutshell"]),
body > div:not([class]):not([id]):has(input[value*="script"]) {
    display: none !important;
}

/* ===== ANIMATION ===== */
@keyframes nutshellFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== FALLBACK FOR ORIGINAL LINKS ===== */
/* Before Nutshell processes, style the original links */
.post-content a[href^="#"]:not(.back-link):not([class]) {
    display: inline;
    background: rgba(45, 79, 60, 0.08);
    color: var(--color-accent, #2D4F3C);
    padding: 0.15em 0.5em;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.post-content a[href^="#"]:not(.back-link):not([class]):hover {
    background: rgba(45, 79, 60, 0.15);
}
