/* ============================================================
   THUNDERDESIGN — Base Styles
   These are intentionally minimal / neutral so students can
   style everything from scratch in Elementor. The important
   stuff is layout and structure, not decoration.
   ============================================================ */

/* ---- FEED LAYOUTS ---- */
.td-feed-wrap {
    width: 100%;
    box-sizing: border-box;
}

.td-feed-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* Grid layout */
.td-layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Magazine layout */
.td-layout-magazine .td-post-card:first-child {
    grid-column: 1 / -1;
}

.td-layout-magazine .td-card-image img {
    max-height: 320px;
    object-fit: cover;
}

/* Minimal layout — strip borders */
.td-layout-minimal .td-post-card {
    border: none !important;
    box-shadow: none !important;
    border-bottom: 1px solid #f3f4f6;
    border-radius: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* ---- BASE CARD ---- */
.td-post-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-sizing: border-box;
    width: 100%;
    transition: box-shadow 0.2s ease;
}

/* Cards layout — elevated */
.td-layout-cards .td-post-card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.td-layout-cards .td-post-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

/* ---- CARD HEADER ---- */
.td-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.td-card-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.td-card-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
    line-height: 1.2;
}

.td-card-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ---- AVATAR SHAPES ---- */
.td-card-avatar {
    flex-shrink: 0;
    object-fit: cover;
    display: block;
}

.td-avatar-circle {
    border-radius: 50%;
}

.td-avatar-square {
    border-radius: 4px;
}

.td-avatar-squircle {
    border-radius: 30%;
}

.td-avatar-hidden {
    display: none !important;
}

/* Preview placeholder in Elementor editor */
.td-preview-avatar {
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    width: 44px;
    height: 44px;
}

/* ---- CONTENT ---- */
.td-card-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- POST IMAGE ---- */
.td-card-image {
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
}

.td-card-image img {
    width: 100%;
    display: block;
    max-height: 400px;
    object-fit: cover;
}

/* ---- PROMPT BADGE ---- */
.td-prompt-badge {
    display: inline-block;
    background: rgba(124,58,237,0.1);
    color: #7c3aed;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    border: 1px solid rgba(124,58,237,0.2);
}

/* ---- CARD PRESET: HERO ---- */
.td-card-preset-hero {
    text-align: center;
    padding: 32px 24px;
}

.td-card-preset-hero .td-card-header {
    flex-direction: column;
    align-items: center;
}

.td-card-preset-hero .td-card-avatar {
    width: 72px !important;
    height: 72px !important;
}

.td-card-preset-hero .td-card-content {
    font-size: 1.2rem;
    line-height: 1.7;
}

/* ---- CARD PRESET: QUOTE ---- */
.td-card-preset-quote .td-card-avatar {
    display: none !important;
}

.td-card-preset-quote .td-card-content {
    font-size: 1.4rem;
    font-style: italic;
    line-height: 1.6;
    position: relative;
    padding-left: 20px;
    border-left: 4px solid currentColor;
}

/* ---- CARD PRESET: NEWSPRINT ---- */
.td-card-preset-newsprint {
    font-family: Georgia, serif;
}

.td-card-preset-newsprint .td-card-content {
    font-size: 1rem;
    line-height: 1.8;
}

.td-card-preset-newsprint .td-card-author {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
}

/* ---- COMPACT PRESET ---- */
.td-card-preset-compact {
    padding: 10px 12px;
}

.td-card-preset-compact .td-card-avatar {
    width: 28px !important;
    height: 28px !important;
}

.td-card-preset-compact .td-card-content {
    font-size: 0.85rem;
    margin-bottom: 6px;
}

/* ---- REACTIONS ---- */
.td-card-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

.td-reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #374151;
}

.td-comment-pill {
    color: #6b7280;
}

/* ---- REACTION COUNTER MODES ---- */
.td-reaction-counter {
    box-sizing: border-box;
}

.td-big-count {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    color: #111827;
}

.td-big-count-label {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.td-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.td-bar-emoji {
    font-size: 1.2em;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.td-bar-track {
    flex: 1;
    height: 10px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.td-bar-fill {
    height: 100%;
    background: #6366f1;
    border-radius: 10px;
    transition: width 0.8s ease;
    width: 0;
}

.td-bar-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    width: 20px;
    text-align: right;
    flex-shrink: 0;
}

.td-rc-total {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-left: 4px;
}

.td-rc-post-preview {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e5e7eb;
}

.td-rc-post-preview strong {
    font-size: 0.85rem;
    color: #374151;
    display: block;
    margin-bottom: 4px;
}

.td-rc-post-preview p {
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0;
}

/* ---- COMMENT THREAD ---- */
.td-comment-widget {}

.td-thread-header {
    margin-bottom: 12px;
}

.td-comment-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.td-comment-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.td-comment-avatar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.td-comment-avatar {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0;
}

.td-comment-connector {
    width: 2px;
    flex: 1;
    min-height: 12px;
    background: #e5e7eb;
    margin-top: 4px;
    border-radius: 2px;
}

.td-comment-bubble {
    flex: 1;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
}

.td-comment-bubble-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.td-comment-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: #111827;
}

.td-comment-text {
    font-size: 0.88rem;
    color: #374151;
    line-height: 1.5;
}

/* ---- GALLERY PAGE ---- */
.td-gallery {
    font-family: system-ui, sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 20px;
}

.td-gallery-header {
    text-align: center;
    margin-bottom: 32px;
}

.td-gallery-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.td-gallery-header p {
    color: #6b7280;
    font-size: 0.95rem;
}

.td-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.td-gallery-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
}

.td-gallery-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    text-decoration: none;
}

.td-gallery-thumb {
    height: 180px;
    background: linear-gradient(135deg, #f0c040, #7c3aed);
    background-size: cover;
    background-position: center;
}

.td-gallery-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
}

.td-gallery-info {
    padding: 14px;
}

.td-gallery-info strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.td-gallery-info span {
    font-size: 0.8rem;
    color: #9ca3af;
}

.td-gallery-empty {
    text-align: center;
    color: #9ca3af;
    padding: 48px;
}

/* ---- UTILITY ---- */
.td-empty {
    text-align: center;
    color: #9ca3af;
    font-size: 0.9rem;
    padding: 24px;
}

.td-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 14px;
    font-size: 0.88rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    .td-layout-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- COUNT ANIMATION ---- */
@keyframes td-count-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.td-reaction-counter[data-animate="true"] .td-reaction-pill {
    animation: td-count-up 0.4s ease both;
}

.td-reaction-counter[data-animate="true"] .td-reaction-pill:nth-child(1) { animation-delay: 0.05s; }
.td-reaction-counter[data-animate="true"] .td-reaction-pill:nth-child(2) { animation-delay: 0.10s; }
.td-reaction-counter[data-animate="true"] .td-reaction-pill:nth-child(3) { animation-delay: 0.15s; }
.td-reaction-counter[data-animate="true"] .td-reaction-pill:nth-child(4) { animation-delay: 0.20s; }
.td-reaction-counter[data-animate="true"] .td-reaction-pill:nth-child(5) { animation-delay: 0.25s; }
