/*
Theme Name:  Bloom Journal
Theme URI:   https://yourdomain.com
Author:      Your Name
Description: A clean editorial WordPress theme with post grid, lightbox with pagination, announcement bar, search overlay, and sliding sidebar panel.
Version:     1.0.0
License:     GNU General Public License v2 or later
Text Domain: bloom-journal
*/

/* ══════════════════════════════════════════════════════
   RESET & VARIABLES
══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:    #E8453C;
  --teal:   #2A9D8F;
  --yellow: #F4C542;
  --pink:   #E91E8C;
  --bg:     #f0eeea;
  --card:   #ffffff;
  --text:   #1a1a1a;
  --muted:  #666666;
  --border: #dddddd;
  --serif:  Georgia, 'Times New Roman', serif;
  --sans:   'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --thumb-height: 180px; /* fixed thumbnail height */
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button { font-family: var(--sans); }

/* ══════════════════════════════════════════════════════
   ADMIN BAR (theme-custom, separate from WP toolbar)
══════════════════════════════════════════════════════ */
#bj-admin-bar {
  background: #1d2327;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#bj-admin-bar span { color: #a7aaad; font-size: 11px; }
.bj-admin-btn {
  background: #2271b1; border: none; color: #fff;
  padding: 3px 10px; border-radius: 3px; font-size: 11px; cursor: pointer;
}
.bj-admin-btn:hover { background: #135e96; }

/* Announcement editor (admin only) */
#bj-ann-editor {
  background: #fff;
  border: 1.5px solid var(--teal);
  border-radius: var(--r-sm);
  padding: 14px 20px;
  display: none;
}
#bj-ann-editor.open { display: block; }
#bj-ann-editor label {
  display: block;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--teal); margin-bottom: 6px;
}
#bj-ann-editor textarea {
  width: 100%; border: .5px solid #ccc; border-radius: var(--r-sm);
  padding: 8px; font-size: 13px; font-family: var(--sans);
  resize: none; height: 58px; outline: none;
}
#bj-ann-editor textarea:focus { border-color: var(--teal); }
.bj-ann-btns { display: flex; gap: 8px; margin-top: 8px; }
.bj-ann-btns button { padding: 5px 14px; border-radius: var(--r-sm); border: none; cursor: pointer; font-size: 12px; }
.bj-ann-save   { background: var(--teal); color: #fff; }
.bj-ann-cancel { background: #eee; color: #555; }

/* ══════════════════════════════════════════════════════
   ANNOUNCEMENT BAR
══════════════════════════════════════════════════════ */
#bj-announcement {
  background: var(--teal);
  color: #fff;
  padding: 9px 48px 9px 20px;
  font-size: 13px;
  text-align: center;
  position: relative;
}
#bj-announcement.hidden { display: none; }
#bj-ann-close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 20px; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background .15s;
}
#bj-ann-close:hover { background: rgba(255,255,255,.2); }

/* ══════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════ */
#bj-header {
  background: var(--red);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 200;
}
.bj-logo {
  color: #fff; font-family: var(--serif);
  font-size: 20px; font-weight: 700; letter-spacing: .3px;
}
.bj-logo img { height: 40px; width: auto; }
#bj-header nav { display: flex; gap: 6px; }
#bj-header nav a {
  color: rgba(255,255,255,.85); font-size: 13px;
  padding: 5px 11px; border-radius: var(--r-sm); transition: .15s;
}
#bj-header nav a:hover,
#bj-header nav .current-menu-item a { background: rgba(255,255,255,.18); color: #fff; }

/* ══════════════════════════════════════════════════════
   LAYOUT SHELL
══════════════════════════════════════════════════════ */
#bj-layout { display: flex; position: relative; min-height: 500px; }

/* ══════════════════════════════════════════════════════
   POST GRID
══════════════════════════════════════════════════════ */
#bj-grid-wrap {
  flex: 1; min-width: 0;
  padding: 20px 18px 0 20px;
  display: flex; flex-direction: column;
}

#bj-grid {
  display: grid;
  grid-template-columns: repeat(var(--bj-cols, 3), minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 960px) { #bj-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px) { #bj-grid { grid-template-columns: 1fr; } }

/* Card */
.bj-card {
  background: var(--card);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  border: .5px solid var(--border);
  transition: transform .18s, box-shadow .18s;
}
.bj-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0,0,0,.11);
}

/* ── Fixed-size thumbnail ── */
.bj-card-thumb {
  width: 100%;
  height: var(--thumb-height);
  overflow: hidden;
  position: relative;
  background: #eee;
}
.bj-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;       /* crop to fill, never stretch */
  object-position: center;
  display: block;
  transition: transform .3s;
}
.bj-card:hover .bj-card-thumb img { transform: scale(1.04); }

/* No-image placeholder */
.bj-card-thumb-placeholder {
  width: 100%;
  height: var(--thumb-height);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
  color: #bbb;
}

/* Card body */
.bj-card-body { padding: 12px 14px 14px; }
.bj-card-cat {
  font-size: 10px; font-weight: 700; color: var(--teal);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px;
}
.bj-card-title {
  font-family: var(--serif); font-size: 14px; font-weight: 700;
  color: var(--text); line-height: 1.4; margin-bottom: 6px;
  /* 2-line clamp so grid stays uniform */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bj-card-excerpt {
  font-size: 12px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bj-card-meta {
  font-size: 10px; color: #999;
  margin-top: 8px; display: flex; gap: 8px; align-items: center;
}
.bj-card-meta time { font-style: normal; }

/* ══════════════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════════════ */
#bj-pg-status {
  font-size: 11px; color: var(--muted);
  text-align: center; padding: 16px 0 4px;
}
#bj-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 10px 0 22px; flex-wrap: wrap;
}
.bj-pg {
  min-width: 34px; height: 34px;
  border: .5px solid #ccc; border-radius: var(--r-sm);
  background: var(--card); cursor: pointer;
  font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px; transition: .15s;
}
.bj-pg:hover:not(.active):not(.dots) { border-color: var(--teal); color: var(--teal); }
.bj-pg.active { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
.bj-pg.dots   { border: none; background: none; cursor: default; pointer-events: none; }
.bj-pg-prev, .bj-pg-next { min-width: 70px; font-size: 12px; font-weight: 600; }
.bj-pg-prev:disabled, .bj-pg-next:disabled { opacity: .38; cursor: not-allowed; pointer-events: none; }
.bj-pg-jump { display: flex; align-items: center; gap: 6px; margin-left: 6px; }
.bj-pg-jump label { font-size: 11px; color: var(--muted); }
.bj-pg-jump input {
  width: 64px; padding: 5px 8px;
  border: .5px solid #ccc; border-radius: var(--r-sm);
  font-size: 12px; font-family: var(--sans); outline: none;
}
.bj-pg-jump input:focus { border-color: var(--teal); }
.bj-pg-jump button {
  padding: 5px 10px; border: .5px solid var(--teal);
  border-radius: var(--r-sm); background: none;
  color: var(--teal); font-size: 11px; font-weight: 700; cursor: pointer;
}
.bj-pg-jump button:hover { background: var(--teal); color: #fff; }

/* ══════════════════════════════════════════════════════
   FAB BUTTONS (Search + Sidebar toggles)
══════════════════════════════════════════════════════ */
#bj-fabs {
  position: absolute; right: 0; top: 20px;
  display: flex; flex-direction: column; gap: 7px; z-index: 100;
}
.bj-fab {
  width: 36px; height: 36px;
  background: var(--pink); border: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer; color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; box-shadow: -2px 2px 8px rgba(0,0,0,.15);
}
.bj-fab:hover { background: #c9157a; }

/* ══════════════════════════════════════════════════════
   SIDEBAR PANEL
══════════════════════════════════════════════════════ */
#bj-sidebar {
  width: 0; overflow: hidden;
  transition: width .32s cubic-bezier(.4,0,.2,1);
  background: var(--card);
  border-left: .5px solid #e0e0e0;
  flex-shrink: 0;
}
#bj-sidebar.open { width: 240px; }
.bj-sb-inner { width: 240px; padding: 18px 16px; }
.bj-sb-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.bj-sb-title { font-family: var(--serif); font-size: 16px; color: var(--text); }
.bj-sb-close {
  background: none; border: .5px solid #ddd; border-radius: var(--r-sm);
  padding: 3px 10px; cursor: pointer; font-size: 12px; color: var(--muted);
}
.bj-sb-close:hover { border-color: var(--red); color: var(--red); }

/* Widgets inside sidebar */
.bj-widget { margin-bottom: 18px; padding-bottom: 16px; border-bottom: .5px solid #eee; }
.bj-widget:last-child { border-bottom: none; margin-bottom: 0; }
.bj-widget-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--muted); margin-bottom: 10px;
}
/* Tag cloud */
.bj-tag {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  background: #f0f0f0; font-size: 11px; color: #555;
  margin: 2px; cursor: pointer; transition: .12s;
}
.bj-tag:hover, a.bj-tag:hover { background: var(--teal); color: #fff; }

/* Recent posts in sidebar */
.bj-recent-item {
  display: flex; gap: 10px; margin-bottom: 10px;
  cursor: pointer; align-items: flex-start;
}
.bj-recent-thumb {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  object-fit: cover; flex-shrink: 0;
}
.bj-recent-thumb-placeholder {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  background: #f0f0f0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.bj-recent-text { font-size: 12px; color: var(--text); line-height: 1.4; }
.bj-recent-text time { font-size: 10px; color: var(--muted); display: block; margin-top: 2px; }

/* ══════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════ */
#bj-footer {
  background: var(--yellow);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
#bj-footer p { font-size: 12px; color: #555; }
.bj-footer-links a { font-size: 12px; color: #555; margin-left: 16px; transition: .12s; }
.bj-footer-links a:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════
   SEARCH OVERLAY
══════════════════════════════════════════════════════ */
#bj-search-overlay {
  position: fixed; inset: 0;
  background: rgba(232,69,60,.96);
  z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .22s;
}
#bj-search-overlay.open { opacity: 1; pointer-events: all; }
#bj-search-overlay h2 {
  color: #fff; font-family: var(--serif);
  font-size: 22px; margin-bottom: 20px;
}
#bj-search-form {
  display: flex; width: 80%; max-width: 440px;
}
#bj-search-input {
  flex: 1; padding: 12px 16px;
  border: none; border-radius: 8px 0 0 8px;
  font-size: 15px; outline: none; font-family: var(--sans);
}
#bj-search-btn {
  background: #fff; color: var(--red);
  border: none; padding: 12px 18px;
  border-radius: 0 8px 8px 0;
  cursor: pointer; font-size: 18px; font-weight: 700;
}
#bj-search-close {
  position: absolute; top: 20px; right: 22px;
  background: none; border: none; color: #fff;
  font-size: 28px; cursor: pointer; opacity: .85; line-height: 1;
}
#bj-search-close:hover { opacity: 1; }
.bj-search-tags { margin-top: 16px; text-align: center; }
.bj-search-tags a {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  background: rgba(255,255,255,.2); color: #fff;
  font-size: 12px; margin: 3px; transition: .12s;
}
.bj-search-tags a:hover { background: rgba(255,255,255,.4); }

/* ══════════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════════ */
#bj-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .22s;
}
#bj-lightbox.open { opacity: 1; pointer-events: all; }

#bj-lb-inner {
  background: var(--card);
  border-radius: var(--r-lg);
  width: 90%; max-width: 660px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(18px);
  transition: transform .22s;
}
#bj-lightbox.open #bj-lb-inner { transform: translateY(0); }

/* Lightbox header */
#bj-lb-head { padding: 20px 22px 0; position: relative; flex-shrink: 0; }
#bj-lb-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--muted); width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: .12s;
}
#bj-lb-close:hover { background: #f5f5f5; color: var(--text); }
.bj-lb-cat {
  font-size: 10px; font-weight: 700; color: var(--teal);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 5px;
}
.bj-lb-title {
  font-family: var(--serif); font-size: 20px; font-weight: 700;
  color: var(--text); line-height: 1.3; padding-right: 32px;
}
.bj-lb-meta { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* Lightbox page tabs */
#bj-lb-tabs {
  display: flex;
  border-bottom: .5px solid #e5e5e5;
  padding: 0 22px; flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
}
#bj-lb-tabs::-webkit-scrollbar { display: none; }
.bj-lb-tab {
  padding: 9px 14px; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; transition: .12s;
}
.bj-lb-tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.bj-lb-tab:hover:not(.active) { color: var(--text); }

/* Lightbox body */
#bj-lb-body {
  flex: 1; overflow-y: auto;
  padding: 16px 22px;
  font-size: 14px; color: #333; line-height: 1.75;
}
#bj-lb-body p { margin-bottom: 12px; }
#bj-lb-body h2, #bj-lb-body h3 {
  font-family: var(--serif); color: var(--text); margin: 18px 0 8px;
}
#bj-lb-body img {
  max-width: 100%; height: auto; border-radius: var(--r-sm); margin: 12px 0;
}
.bj-lb-loading { text-align: center; padding: 40px; color: #aaa; font-size: 13px; }

/* Lightbox footer */
#bj-lb-footer {
  padding: 13px 22px;
  border-top: .5px solid #eee;
  display: flex; align-items: center; justify-content: space-between;
  background: #fafafa; flex-shrink: 0;
}
#bj-lb-page-nav { display: flex; align-items: center; gap: 7px; }
.bj-lb-pg-btn {
  background: none; border: .5px solid #ccc; border-radius: var(--r-sm);
  padding: 6px 11px; cursor: pointer; font-size: 12px; color: var(--muted);
  transition: .12s;
}
.bj-lb-pg-btn:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.bj-lb-pg-btn:disabled { opacity: .38; cursor: not-allowed; }
#bj-lb-pg-info { font-size: 12px; color: var(--muted); min-width: 56px; text-align: center; }
.bj-lb-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--teal); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border: 1.5px solid var(--teal);
  border-radius: var(--r-sm); transition: .15s;
}
.bj-lb-link:hover { background: var(--teal); color: #fff; }

/* ══════════════════════════════════════════════════════
   SINGLE POST PAGE
══════════════════════════════════════════════════════ */
.bj-single-wrap { max-width: 760px; margin: 40px auto; padding: 0 24px 60px; }
.bj-single-cat {
  font-size: 11px; font-weight: 700; color: var(--teal);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px;
}
.bj-single-title {
  font-family: var(--serif); font-size: 32px; font-weight: 700;
  color: var(--text); line-height: 1.25; margin-bottom: 10px;
}
.bj-single-meta { font-size: 12px; color: var(--muted); margin-bottom: 24px; }
.bj-single-featured {
  width: 100%; height: 380px;
  object-fit: cover; object-position: center;
  border-radius: var(--r-md); margin-bottom: 28px;
}
.bj-single-content { font-size: 15px; line-height: 1.8; color: #333; }
.bj-single-content p  { margin-bottom: 16px; }
.bj-single-content h2,
.bj-single-content h3 { font-family: var(--serif); margin: 28px 0 12px; color: var(--text); }
.bj-single-content img { max-width: 100%; border-radius: var(--r-sm); margin: 20px 0; }
.bj-single-content blockquote {
  border-left: 3px solid var(--teal); margin: 24px 0;
  padding: 10px 20px; color: var(--muted); font-style: italic;
}

/* ══════════════════════════════════════════════════════
   SEARCH RESULTS PAGE
══════════════════════════════════════════════════════ */
.bj-search-wrap { max-width: 900px; margin: 0 auto; padding: 30px 24px 60px; }
.bj-search-wrap h1 { font-family: var(--serif); font-size: 22px; margin-bottom: 20px; }

/* ══════════════════════════════════════════════════════
   404 PAGE
══════════════════════════════════════════════════════ */
.bj-404 {
  text-align: center; padding: 80px 24px;
  font-family: var(--serif);
}
.bj-404 .bj-404-code { font-size: 80px; color: var(--red); font-weight: 700; line-height: 1; }
.bj-404 h2 { font-size: 24px; margin: 16px 0 10px; }
.bj-404 p  { color: var(--muted); margin-bottom: 24px; }
.bj-btn {
  display: inline-block; padding: 10px 22px;
  background: var(--teal); color: #fff; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; transition: .15s;
}
.bj-btn:hover { background: #238276; }