/* Card grid — fixed 3 cols so layout holds even with 1 post */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.45s var(--spring), box-shadow 0.35s var(--ease-soft);
    border: 1px solid rgba(0, 0, 0, 0.02);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.card:hover {
    transform: translateY(-7px) scale(1.01);
    box-shadow: var(--shadow-lift);
}

.card:active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.card-img-placeholder {
    height: 180px;
    background: #eee;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.card-img-placeholder::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

/* Glass highlight overlay — neutral white, no pink tint */
.card-img-placeholder::after {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.30), transparent 45%);
    pointer-events: none;
    z-index: 2;
}

.grad-1 .card-img-placeholder::before { background: linear-gradient(120deg, #f6d365 0%, #fda085 100%); }
.grad-2 .card-img-placeholder::before { background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%); }
.grad-3 .card-img-placeholder::before { background: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%); }
.grad-4 .card-img-placeholder::before { background: linear-gradient(120deg, #fbc2eb 0%, #a6c1ee 100%); }
.grad-5 .card-img-placeholder::before { background: linear-gradient(120deg, #ffecd2 0%, #fcb69f 100%); }
.grad-6 .card-img-placeholder::before { background: linear-gradient(120deg, #a18cd1 0%, #fbc2eb 100%); }
.grad-7 .card-img-placeholder::before { background: linear-gradient(120deg, #ff9a9e 0%, #fecfef 100%); }
.grad-8 .card-img-placeholder::before { background: linear-gradient(120deg, #43e97b 0%, #38f9d7 100%); }
.grad-9 .card-img-placeholder::before { background: linear-gradient(120deg, #f093fb 0%, #f5576c 100%); }
.grad-10 .card-img-placeholder::before { background: linear-gradient(120deg, #4facfe 0%, #00f2fe 100%); }
.grad-11 .card-img-placeholder::before { background: linear-gradient(120deg, #f9748f 0%, #fe9a8b 100%); }
.grad-12 .card-img-placeholder::before { background: linear-gradient(120deg, #96fbc4 0%, #f9f586 100%); }

.card-img-placeholder .card-emoji {
    position: relative;
    z-index: 1;
    font-size: 3rem;
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.card p {
    font-size: 0.88rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

.card-meta {
    width: 100%;
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.78rem;
    color: #bbb;
}

.card-by {
    display: block;
    text-align: right;
    font-style: italic;
    color: #d0c4bb;
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.8rem;
    margin-right: 0.3rem;
}

.tag.pink { background: #ffe0e0; color: #c0392b; }
.tag.green { background: #d4edda; color: #27ae60; }
.tag.blue { background: #d6eaf8; color: #2980b9; }
.tag.purple { background: #e8daef; color: #8e44ad; }

/* Month tabs */
.month-tabs {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.month-tab {
    padding: 0.4rem 1.2rem;
    border: 2px solid #eee;
    background: white;
    border-radius: 25px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.3s var(--ease-soft), transform 0.3s var(--spring);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.month-tab:hover {
    border-color: var(--accent-pink);
    color: var(--text-main);
    transform: translateY(-2px);
}

.month-tab:active {
    background: #fff5f5;
    border-color: var(--accent-pink);
    color: var(--text-main);
}

.month-tab.active {
    border-color: var(--accent-pink);
    background: #fff5f5;
    color: var(--text-main);
}

/* Expand button */
.expand-btn {
    display: block;
    margin: 2rem auto 0;
    padding: 0.6rem 2rem;
    border: 2px dashed #ddd;
    background: transparent;
    border-radius: 30px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.expand-btn:hover,
.expand-btn:active {
    border-color: var(--accent-pink);
    color: var(--accent-pink);
    transform: translateY(-2px);
}

.expand-btn.expanded {
    border-style: solid;
    border-color: #eee;
}

/* Rec grid */
.rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.rec-card {
    background: white;
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: transform 0.3s;
}

.rec-card:hover,
.rec-card:active {
    transform: translateY(-3px);
}

.rec-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.rec-card h4 {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.rec-card p {
    font-size: 0.78rem;
    color: var(--text-light);
}

/* Timeline */
.timeline {
    margin-top: 1rem;
}

.timeline-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.timeline-date {
    min-width: 90px;
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-light);
    padding-top: 0.15rem;
    font-weight: 500;
}

.timeline-dot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline-dot::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-pink);
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--accent-pink);
    flex-shrink: 0;
}

/* Latest (first) timeline dot gets a ripple pulse */
.timeline-item:first-child .timeline-dot::before {
    animation: timelineDotPulse 2.4s ease-out infinite;
}

.timeline-dot::after {
    content: '';
    width: 2px;
    flex: 1;
    background: linear-gradient(to bottom, rgba(168, 230, 207, 0.4), rgba(255, 183, 178, 0.25));
    margin-top: 4px;
}

.timeline-item:last-child .timeline-dot::after {
    display: none;
}

.timeline-content {
    background: white;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    flex: 1;
}

.timeline-content h4 {
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.timeline-content p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.timeline-divider {
    text-align: center;
    margin: 1.5rem 0;
    color: #ccc;
    font-size: 0.8rem;
    position: relative;
}

.timeline-divider::before,
.timeline-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: #eee;
}

.timeline-divider::before { left: 5%; }
.timeline-divider::after { right: 5%; }

/* Status bar */
.status-bar {
    margin-top: 3rem;
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* Filter bar (gallery) */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 1.2rem;
    border: 2px solid #eee;
    background: white;
    border-radius: 25px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s var(--ease-soft), transform 0.3s var(--spring);
    color: var(--text-light);
    font-weight: 500;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.filter-btn:hover,
.filter-btn.active {
    border-color: var(--accent-pink);
    color: var(--text-main);
    background: #fff5f5;
    transform: translateY(-2px);
}

.filter-btn:active {
    border-color: var(--accent-pink);
    color: var(--text-main);
    background: #fff5f5;
}

/* ── Comments ── */
.post-comments {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 1px dashed #f0f0f0;
}

.comments-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.8rem;
    color: var(--text-main);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.comment-item {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-pink), #ffd1d1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    font-weight: 500;
    flex-shrink: 0;
}

/* Jim 的评论头像 — 绿色调，与 tutorial 的 accent-blue 一致 */
.comment-avatar.jim {
    background: linear-gradient(135deg, var(--accent-blue), #b8f0dc);
}

.comment-body {
    flex: 0 1 auto;
    max-width: 85%;
    background: #fef8f8;
    padding: 0.6rem 0.9rem;
    border-radius: 16px;
    border-top-left-radius: 4px;
}

/* Role-based comment colors */
.comment-body.bling { background: #fef8f8; }
.comment-body.jim   { background: #f0faf5; }
.comment-body.guest { background: #f8f8f8; }
.comment-avatar.guest { background: linear-gradient(135deg, #e0e0e0, #c8c8c8); }

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    flex-wrap: wrap;
}

.comment-author {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent-pink);
}
.comment-body.jim .comment-author { color: #5dba8d; }
.comment-body.guest .comment-author { color: var(--text-light); }

/* Role badge */
.comment-role {
    font-size: 0.58rem;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 400;
    letter-spacing: 0.02em;
}
.comment-role.owner { background: #fff0ef; color: var(--accent-pink); }
.comment-body.jim .comment-role.owner { background: #e8f5e9; color: #5dba8d; }
.comment-role.admin { background: #e8f0fe; color: #4a90d9; }

.comment-time {
    font-size: 0.7rem;
    color: #ccc;
}

.comment-text {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.6;
}

.comment-empty {
    text-align: center;
    color: #ccc;
    font-size: 0.82rem;
    padding: 0.8rem 0;
}

.comment-login-hint {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-light);
    padding: 0.5rem 0;
}

.comment-login-hint a {
    color: var(--accent-pink);
    text-decoration: none;
    font-weight: 500;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-form textarea {
    width: 100%;
    border: 1.5px solid #f0f0f0;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
    outline: none;
    color: var(--text-main);
}

.comment-form textarea:focus {
    border-color: var(--accent-pink);
}

.comment-form textarea::placeholder {
    color: #ccc;
}

.comment-submit {
    align-self: flex-end;
    padding: 0.4rem 1.2rem;
    border: none;
    background: var(--accent-pink);
    color: white;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

.comment-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 183, 178, 0.3);
}

.comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
