/**
 * Nostr for WordPress - Frontend Styles
 * Styles for displaying notes on the frontend across different themes
 */

/* Single Note Card Styling - Match archive design */
body.single-note article.nostr-note,
body.post-type-note.single article.nostr-note {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem 1.75rem;
    margin: 2rem auto;
    max-width: 100%;
    display: block;
}

/* Note Content Container */
.nostr-note-content {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #000000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Break long URLs and nostr profile links */
.nostr-note-content a {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Break long strings in entry-content and post-content for notes */
body.single-note .entry-content,
body.single-note .post-content,
body.post-type-note.single .entry-content,
body.post-type-note.single .post-content,
.nostr-note .entry-content,
.nostr-note .post-content,
.nostr-note-page .nostr-note .entry-content,
.nostr-note-page .nostr-note .post-content,
article.nostr-note .entry-content,
article.nostr-note .post-content {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    max-width: 100%;
    overflow-x: auto;
}

/* Break long strings in all text content (including plain text nostr links) */
body.single-note .entry-content p,
body.single-note .entry-content span,
body.single-note .entry-content a,
body.single-note .post-content p,
body.single-note .post-content span,
body.single-note .post-content a,
body.post-type-note.single .entry-content p,
body.post-type-note.single .entry-content span,
body.post-type-note.single .entry-content a,
body.post-type-note.single .post-content p,
body.post-type-note.single .post-content span,
body.post-type-note.single .post-content a,
.nostr-note .entry-content p,
.nostr-note .entry-content span,
.nostr-note .entry-content a,
.nostr-note .post-content p,
.nostr-note .post-content span,
.nostr-note .post-content a,
.nostr-note-page .nostr-note .entry-content p,
.nostr-note-page .nostr-note .entry-content span,
.nostr-note-page .nostr-note .entry-content a,
.nostr-note-page .nostr-note .post-content p,
.nostr-note-page .nostr-note .post-content span,
.nostr-note-page .nostr-note .post-content a {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Shortcode container spacing */
.nostr-notes-shortcode {
    margin-bottom: 1.5rem;
}

.nostr-notes-shortcode article.nostr-note:last-child {
    margin-bottom: 0;
}

article.nostr-note-shortcode {
    margin-bottom: 1.5rem;
}

/* Style our custom note metadata (only the one we add) */
body.single-note .nostr-note .nostr-note-meta,
body.post-type-note.single .nostr-note .nostr-note-meta,
.nostr-note-meta,
.nostr-notes-shortcode .nostr-note-meta,
article.nostr-note-shortcode .nostr-note-meta {
    font-size: 0.875rem;
    color: #666666;
    opacity: 0.8;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: none;
}

/* Style timestamp in our custom metadata */
body.single-note .nostr-note .nostr-note-meta time,
body.post-type-note.single .nostr-note .nostr-note-meta time,
.nostr-note-meta time,
.nostr-notes-shortcode .nostr-note-meta time,
article.nostr-note-shortcode .nostr-note-meta time {
    color: #666666;
    display: block;
    margin-bottom: 0.5rem;
}

/* Style event ID on separate line with small text */
body.single-note .nostr-note .nostr-note-meta .nostr-event-id,
body.post-type-note.single .nostr-note .nostr-note-meta .nostr-event-id,
.nostr-note-meta .nostr-event-id,
.nostr-notes-shortcode .nostr-note-meta .nostr-event-id,
article.nostr-note-shortcode .nostr-note-meta .nostr-event-id {
    font-size: 0.75rem;
    color: #666666;
    opacity: 0.7;
    margin-top: 0.25rem;
    word-break: break-all;
}

body.single-note .nostr-note .nostr-note-meta .nostr-event-id a,
body.post-type-note.single .nostr-note .nostr-note-meta .nostr-event-id a,
.nostr-note-meta .nostr-event-id a,
.nostr-notes-shortcode .nostr-note-meta .nostr-event-id a,
article.nostr-note-shortcode .nostr-note-meta .nostr-event-id a {
    color: #666666;
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.single-note .nostr-note .nostr-note-meta .nostr-event-id a:hover,
body.post-type-note.single .nostr-note .nostr-note-meta .nostr-event-id a:hover,
.nostr-note-meta .nostr-event-id a:hover,
.nostr-notes-shortcode .nostr-note-meta .nostr-event-id a:hover,
article.nostr-note-shortcode .nostr-note-meta .nostr-event-id a:hover {
    opacity: 1;
}

/* Clean note display for archives - similar card style */
.nostr-note-page:not(.single-note) article.nostr-note,
.nostr-notes-shortcode article.nostr-note,
article.nostr-note-shortcode {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
}

/* For themes with dark mode support */
@media (prefers-color-scheme: dark) {
    body.single-note article.nostr-note,
    body.post-type-note.single article.nostr-note,
    .nostr-note-page:not(.single-note) article.nostr-note {
        background: #1a1a1a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .nostr-note-content {
        color: #ffffff;
    }
    
    body.single-note .nostr-note .nostr-note-meta,
    body.post-type-note.single .nostr-note .nostr-note-meta,
    body.single-note .nostr-note .nostr-note-meta time,
    body.post-type-note.single .nostr-note .nostr-note-meta time,
    body.single-note .nostr-note .nostr-note-meta .nostr-event-id,
    body.post-type-note.single .nostr-note .nostr-note-meta .nostr-event-id,
    body.single-note .nostr-note .nostr-note-meta .nostr-event-id a,
    body.post-type-note.single .nostr-note .nostr-note-meta .nostr-event-id a {
        color: #cccccc;
    }
}

/* Archive/List View - Keep titles visible but subtle */
.nostr-note-page:not(.single-note) .nostr-note .entry-title,
.nostr-note-page:not(.single-note) .nostr-note .post-title,
.nostr-note-page:not(.single-note) .nostr-note h2,
.nostr-note-page:not(.single-note) .nostr-note h2 a {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.7;
    color: inherit;
    margin-bottom: 0.5rem;
}

/* Note content in archives - excerpt-like */
.nostr-note-page:not(.single-note) .nostr-note .nostr-note-content,
.nostr-note-page:not(.single-note) .nostr-note .entry-content {
    font-size: 1rem;
    line-height: 1.6;
}

/* Ensure note content is readable */
.nostr-note-content p {
    margin-bottom: 1rem;
}

.nostr-note-content p:last-child {
    margin-bottom: 0;
}

/* Better spacing for note metadata in archives */
.nostr-note-page:not(.single-note) .nostr-note .entry-meta,
.nostr-note-page:not(.single-note) .nostr-note .post-meta {
    font-size: 0.875rem;
    color: #666666;
    opacity: 0.8;
    margin-top: 0.75rem;
}

/* Hide title in various theme structures */
body.nostr-note-page.single-note .site-main article h1.entry-title,
body.nostr-note-page.single-note .site-main article h1.post-title,
body.nostr-note-page.single-note .content-area article h1.entry-title,
body.nostr-note-page.single-note .content-area article h1.post-title,
body.nostr-note-page.single-note main article h1.entry-title,
body.nostr-note-page.single-note main article h1.post-title,
body.nostr-note-page.single-note .post-content h1.entry-title,
body.nostr-note-page.single-note .post-content h1.post-title {
    display: none !important;
}

/* Generic title hiding for note post type */
body.post-type-note.single .entry-title:empty,
body.post-type-note.single h1.entry-title:empty,
body.post-type-note.single .post-title:empty,
body.post-type-note.single h1.post-title:empty {
    display: none !important;
}

/* Support for block themes */
.nostr-note-page.single-note .wp-block-post-title,
.nostr-note-page.single-note h1.wp-block-post-title {
    display: none !important;
}

/* Ensure content area is clean and readable */
body.single-note .entry-content,
body.single-note .post-content,
body.post-type-note.single .entry-content,
body.post-type-note.single .post-content {
    padding-top: 0;
    margin-top: 0;
}

/* Center single note cards with reasonable max-width */
body.single-note article.nostr-note,
body.post-type-note.single article.nostr-note {
    /* Cards look best with some max-width, but let theme handle it */
    max-width: 680px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body.single-note article.nostr-note,
    body.post-type-note.single article.nostr-note,
    .nostr-note-page:not(.single-note) article.nostr-note {
        padding: 1.25rem 1.5rem;
        border-radius: 10px;
        margin-bottom: 1.25rem;
    }
    
    .nostr-note-content {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    body.single-note .nostr-note .nostr-note-meta,
    body.post-type-note.single .nostr-note .nostr-note-meta {
        font-size: 0.8125rem;
    }
}

/* Ensure proper spacing and alignment */
body.single-note article.nostr-note .entry-content,
body.post-type-note.single article.nostr-note .entry-content {
    margin: 0;
    padding: 0;
}

