/* ================================================================
   BLOG PAGE — public-facing /blog
   Builds on top of style.css which is already loaded.
   ================================================================ */

/* ── Hero ──────────────────────────────────────────────────────── */
.blog-hero {
    position: relative;
    padding: 10rem 0 5rem;   /* 10rem top = clears fixed 64px header + breathing room */
    text-align: center;
    overflow: hidden;
}

.blog-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* Reuses .hero-gradient from style.css */
.blog-hero-bg .hero-gradient {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e1fff3 0%, #F5F7FA 40%, #dbeafe 70%, #e1fff3 100%);
}

.blog-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.blog-hero-tag {
    display: inline-block;
    background: #00A862;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.3rem 1rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.blog-hero-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(2.2rem, 5.5vw, 3.5rem);
    color: #1A252F;
    line-height: 1.12;
    margin: 0 0 1.1rem;
    letter-spacing: -0.02em;
}

.blog-hero-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: #4b5563;
    line-height: 1.65;
    margin: 0;
    max-width: 520px;
    margin: 0 auto;
}

/* ── Main layout ────────────────────────────────────────────────── */
.blog-main {
    padding: 3rem 1rem 6rem;
}

/* ── Posts grid ─────────────────────────────────────────────────── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
    margin-bottom: 3rem;
}

@media (max-width: 1024px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .posts-grid { grid-template-columns: 1fr; }
}

/* ── Post card ──────────────────────────────────────────────────── */
.post-card {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    outline: none;
}

.post-card:hover,
.post-card:focus {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(0,0,0,0.13);
}

/* Skeleton loader */
.post-card.skeleton {
    min-height: 320px;
    cursor: default;
    background: linear-gradient(90deg,#f3f4f6 0%,#e5e7eb 50%,#f3f4f6 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    box-shadow: none;
}
.post-card.skeleton:hover { transform: none; box-shadow: none; }

@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Card image band ────────────────────────────────────────────── */
.post-card-image {
    height: 160px;
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    flex-shrink: 0;
}

/* When a real banner is present the wrapper becomes a positioning context */
.post-card-image.has-banner {
    padding: 0;
    position: relative;
    overflow: hidden;
}

.post-card-image.has-banner .post-card-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    inset: 0;
}

/* Tag pill floated over the banner image */
.post-card-image.has-banner .post-tag {
    position: absolute;
    top: 0.75rem;
    left: 0.85rem;
    z-index: 1;
    background: rgba(0,0,0,0.38);
    border-color: rgba(255,255,255,0.25);
}

.post-tag {
    display: inline-block;
    background: rgba(255,255,255,0.22);
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.35);
    backdrop-filter: blur(4px);
}

/* ── Card body ──────────────────────────────────────────────────── */
.post-card-body {
    padding: 1.35rem 1.35rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.6rem;
}

.post-card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1A252F;
    line-height: 1.38;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-excerpt {
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Author row ─────────────────────────────────────────────────── */
.post-author {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid #f0f0f0;
}

.post-author-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #00A862;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.post-author-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.post-author-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    color: #1A252F;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-meta {
    font-family: 'Outfit', sans-serif;
    font-size: 0.76rem;
    color: #9ca3af;
}

/* ── Empty state ────────────────────────────────────────────────── */
.post-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 6rem 1rem;
    text-align: center;
}

.post-empty h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #1A252F;
    margin: 0;
}

.post-empty p {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: #9ca3af;
    margin: 0;
}

/* ── Pagination ─────────────────────────────────────────────────── */
.blog-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.blog-pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #00A862;
    background: #fff;
    border: 2px solid #00A862;
    border-radius: 8px;
    padding: 0.55rem 1.2rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.blog-pagination-btn:hover:not(:disabled) {
    background: #00A862;
    color: #fff;
}

.blog-pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.blog-pagination-info {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #6b7280;
}

/* ── Responsive hero ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .blog-hero { padding: 8rem 0 3.5rem; }
    .blog-hero-title { font-size: 2rem; }
    .blog-hero-subtitle { font-size: 1rem; }
}


/* ================================================================
   OFFICE BLOG TAB — editor inside office.html
   All classes must be compatible with office.css variables.
   ================================================================ */

.blog-editor-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .blog-editor-layout { grid-template-columns: 1fr; }
}

/* ── Editor card ─────────────────────────────────────────────────  */
.blog-editor-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.blog-editor-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* ── Publish button (distinct from btn-primary) ─────────────────── */
.btn-publish {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #065f46;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm, 8px);
    padding: 0.55rem 1.1rem;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}
.btn-publish:hover { background: #047857; transform: translateY(-1px); }

/* ── Post list (right column) ───────────────────────────────────── */
.blog-post-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 520px;
    overflow-y: auto;
}

.blog-post-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.blog-post-item:hover { border-color: var(--primary); }

.blog-post-item.editing {
    border-color: var(--primary);
    background: rgba(0, 168, 98, 0.06);
}

.blog-post-item-info {
    flex: 1;
    min-width: 0;
}

.blog-post-item-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-post-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Status badge ───────────────────────────────────────────────── */
.blog-status-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.blog-status-badge.draft     { background: #fef3c7; color: #92400e; }
.blog-status-badge.published { background: #d1fae5; color: #065f46; }

/* ── Editor actions row ─────────────────────────────────────────── */
.blog-editor-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ── Textarea ───────────────────────────────────────────────────── */
.blog-textarea {
    width: 100%;
    min-height: 260px;
    resize: vertical;
    font-family: var(--font);
    font-size: 0.9rem;
    line-height: 1.65;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 8px);
    background: var(--bg);
    color: var(--text);
    box-sizing: border-box;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.blog-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,168,98,0.12);
}

/* ── Published pill on existing posts ──────────────────────────── */
.blog-published-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
}

/* ── Empty list state ───────────────────────────────────────────── */
.blog-post-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.blog-post-empty svg {
    display: block;
    margin: 0 auto 0.75rem;
    opacity: 0.3;
}

/* ── Banner upload — drag-and-drop zone ─────────────────────────── */
.blog-banner-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 2px dashed var(--border, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
    padding: 1.5rem 1rem;
    cursor: pointer;
    background: var(--bg, #f9fafb);
    color: var(--text-secondary, #6b7280);
    transition: border-color 0.18s, background 0.18s;
    text-align: center;
    margin-bottom: 0.85rem;
}

.blog-banner-dropzone:hover,
.blog-banner-dropzone.dragover {
    border-color: var(--primary, #00A862);
    background: rgba(0, 168, 98, 0.05);
    color: var(--primary, #00A862);
}

.blog-banner-dropzone svg {
    opacity: 0.55;
    flex-shrink: 0;
    transition: opacity 0.18s;
}

.blog-banner-dropzone:hover svg,
.blog-banner-dropzone.dragover svg {
    opacity: 1;
}

/* ── Banner upload — image preview ──────────────────────────────── */
.blog-banner-preview {
    position: relative;
    border-radius: var(--radius-sm, 8px);
    overflow: hidden;
    margin-bottom: 0.85rem;
    line-height: 0;
}

.blog-banner-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-sm, 8px);
}

.blog-banner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0.4rem;
    padding: 0.6rem;
    background: linear-gradient(to top, rgba(0,0,0,0.52) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.18s ease;
    border-radius: var(--radius-sm, 8px);
}

.blog-banner-preview:hover .blog-banner-overlay {
    opacity: 1;
}

.blog-banner-change-btn,
.blog-banner-remove-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font, 'Outfit', sans-serif);
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    line-height: 1;
}

.blog-banner-change-btn {
    background: rgba(255,255,255,0.88);
    color: #1A252F;
}

.blog-banner-change-btn:hover {
    background: #fff;
    transform: translateY(-1px);
}

.blog-banner-remove-btn {
    background: rgba(239,68,68,0.82);
    color: #fff;
}

.blog-banner-remove-btn:hover {
    background: #ef4444;
    transform: translateY(-1px);
}

/* ── Banner upload — locked / pre-save hint ──────────────────────  */
.blog-banner-locked {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    background: var(--bg, #f9fafb);
    border: 1px dashed var(--border, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
    margin-bottom: 0.85rem;
    color: var(--text-secondary, #9ca3af);
}

.blog-banner-locked svg {
    flex-shrink: 0;
    opacity: 0.45;
}

.blog-banner-hint {
    font-family: var(--font, 'Outfit', sans-serif);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

.blog-banner-hint-sub {
    font-family: var(--font, 'Outfit', sans-serif);
    font-size: 0.74rem;
    color: var(--text-secondary, #9ca3af);
    margin: 0;
}

/* ── Public blog card — banner image variant ─────────────────────  */
.post-card-image img.post-card-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ══════════════════════════════════════════════════════════════════
   POST DETAIL PAGE
   ══════════════════════════════════════════════════════════════════ */

/* Detail mode: main gets extra top padding to clear fixed 64px header */
.blog-main--detail {
    padding: 0 0 6rem;
    padding-top: 64px; /* fixed header height */
}

/* Loading spinner */
.post-detail-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.post-detail-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e5e7eb;
    border-top-color: #00A862;
    border-radius: 50%;
    animation: pd-spin 0.7s linear infinite;
}

@keyframes pd-spin {
    to { transform: rotate(360deg); }
}

/* ── Full-width banner (above the column) ──────────────────────── */
.post-detail-banner-wrap {
    width: 100%;
    max-height: 460px;
    overflow: hidden;
    line-height: 0;
}

.post-detail-banner-wrap img {
    width: 100%;
    height: 460px;
    object-fit: cover;
    display: block;
}

/* ── Centred column that holds the article ─────────────────────── */
.post-detail-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

/* ── Article ────────────────────────────────────────────────────── */
.post-detail {
    /* no extra styles needed – container does the work */
}

/* Back link */
.post-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #00A862;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 1.75rem;
    transition: gap 0.18s;
}

.post-detail-back:hover {
    gap: 0.6rem;
    text-decoration: underline;
}

/* Category tag */
.post-detail-tag {
    display: inline-block;
    background: rgba(0, 168, 98, 0.1);
    color: #00A862;
    border: 1px solid rgba(0, 168, 98, 0.28);
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

/* Title */
.post-detail-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    color: #1A252F;
    margin: 0 0 0.85rem;
    letter-spacing: -0.025em;
}

/* Excerpt / sub-heading */
.post-detail-excerpt {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: #6b7280;
    line-height: 1.7;
    margin: 0 0 1.5rem;
    font-style: italic;
}

/* Author row */
.post-detail-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

/* Divider between meta and body */
.post-detail-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin-bottom: 2rem;
}

/* Body prose */
.post-detail-body {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    line-height: 1.9;
    color: #1A252F;
}

.post-detail-body p {
    margin: 0 0 1.4rem;
}

.post-detail-body p:last-child {
    margin-bottom: 0;
}

/* Footer */
.post-detail-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 1.75rem;
    margin-top: 3rem;
}

/* Error state */
.post-detail-error {
    text-align: center;
    padding: 5rem 1rem;
    color: #6b7280;
}

.post-detail-error h2 {
    font-size: 1.5rem;
    margin: 1rem 0 0.5rem;
    color: #1A252F;
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .post-detail-banner-wrap img {
        height: 260px;
    }

    .post-detail-container {
        padding: 2rem 1.25rem 3rem;
    }
}

@media (max-width: 480px) {
    .post-detail-banner-wrap img {
        height: 200px;
    }

    .post-detail-title {
        font-size: 1.6rem;
    }
}
