/* ============================================================
   blog/blog.css — the Blog's own layout styles (scaffold phase)
   ============================================================
   Palette + form controls come from the shared theme (js/ui/theme.js
   injects the --whimle-* variables at runtime); this file is layout:
   header, hero, post-list area, and the account slide-over. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: sans-serif;
  color: #222;
  background-color: #38b6ff; /* the same Whimle blue as the game page */
  min-height: 100vh;
}

/* ---- header ---- */
.blog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 2px solid #000;
  position: sticky;
  top: 0;
  z-index: 100;
}
.blog-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #222;
}
/* the inline frog mascot SVG (embedded in blog.html) */
.blog-brand-mark { display: inline-flex; line-height: 0; }
.blog-brand-mark svg { width: 36px; height: 36px; }
.blog-brand-name { font-size: 20px; font-weight: 800; }
.blog-brand-sub { color: var(--whimle-blue, #38b6ff); }
.blog-nav { display: flex; align-items: center; gap: 14px; }
.blog-nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--whimle-blue, #38b6ff);
  text-decoration: none;
}
.blog-nav-link:hover { text-decoration: underline; }
.blog-account-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
}
.blog-account-btn:focus-visible {
  outline: 3px solid var(--whimle-lime-ring, rgba(51, 204, 51, 0.35));
  outline-offset: 2px;
}

/* ---- main / hero / posts ----
   The page background is the game's bright blue, so anything sitting
   DIRECTLY on it (hero, back links, pager labels, hints, post chrome)
   uses white / dark-navy ink for contrast; cards stay white boxes. */
.blog-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
.blog-hero h1 { margin: 18px 0 6px; font-size: 30px; color: #fff; text-shadow: 0 1px 2px rgba(4, 34, 58, 0.35); }
.blog-hero p { margin: 0 0 24px; color: #eaf7ff; font-size: 15px; line-height: 1.5; }
.blog-coming-soon {
  background: #fff;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  font-size: 16px;
}
.blog-coming-sub { color: #777; font-size: 13px; }

/* ---- list controls (search / kind toggle / sort / chips) ---- */
.blog-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.blog-search-input { font-size: 16px; }
.blog-controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.blog-kind { display: inline-flex; border: 2px solid #000; border-radius: 10px; overflow: hidden; background: #fff; }
.blog-kind-btn {
  font: inherit; font-size: 13px; font-weight: 700; color: #444;
  background: none; border: none; padding: 8px 14px; cursor: pointer;
}
.blog-kind-btn + .blog-kind-btn { border-left: 1px solid #ccc; }
/* frog lime, not blue — blue-on-blue sank into the page background */
.blog-kind-btn--on { background: var(--whimle-lime, #33CC33); color: #062033; }
.blog-sort { width: auto; padding: 8px 10px; font-size: 13px; }

/* tags filter dropdown */
.blog-tags-dd { position: relative; }
.blog-tags-btn {
  font: inherit; font-size: 13px; font-weight: 700; color: #333;
  background: #fff; border: 2px solid #000; border-radius: 10px;
  padding: 8px 12px; cursor: pointer;
}
.blog-tags-btn:hover { border-color: var(--whimle-lime, #33CC33); }
.blog-tags-btn--on { background: var(--whimle-lime-soft, rgba(51,204,51,.25)); border-color: var(--whimle-lime, #33CC33); }
.blog-tags-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 200;
  min-width: 200px; max-height: 280px; overflow-y: auto;
  background: #fff; border: 2px solid #000; border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 24px rgba(4, 34, 58, 0.3);
}
.blog-tags-menu[hidden] { display: none; }
.blog-tags-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 6px 8px; border-radius: 7px; cursor: pointer;
}
.blog-tags-row:hover { background: var(--whimle-lime-soft, rgba(51,204,51,.18)); }
.blog-tags-row input { accent-color: var(--whimle-lime, #33CC33); cursor: pointer; }
.blog-tags-empty { font-size: 12px; color: #777; margin: 6px 8px; }
.blog-new { width: auto; margin-left: auto; padding: 8px 14px; font-size: 14px; }
/* "My posts" header: title left, ＋ New post pushed right (via .blog-new margin) */
.blog-mine-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.blog-mine-head .blog-post-title { margin: 0; }
.blog-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.blog-chip {
  font: inherit; font-size: 12px; font-weight: 600; color: #333;
  background: #fff; border: 1px solid #999; border-radius: 999px;
  padding: 4px 11px; cursor: pointer;
}
.blog-chip:hover { border-color: var(--whimle-lime, #33CC33); }
.blog-chip--on { background: var(--whimle-lime-soft, rgba(51,204,51,.22)); border-color: var(--whimle-lime, #33CC33); }
.blog-chip--author { background: var(--whimle-blue-soft, rgba(56,182,255,.18)); border-color: var(--whimle-blue, #38b6ff); }

/* ---- post cards ---- */
.blog-cards { display: flex; flex-direction: column; gap: 14px; }
.blog-card { background: #fff; border: 2px solid #000; border-radius: 12px; padding: 14px 16px; }
.blog-card-author { display: flex; align-items: center; gap: 7px; font-size: 13px; flex-wrap: wrap; }
.blog-card-authorname { font: inherit; font-weight: 700; color: #222; background: none; border: none; padding: 0; cursor: pointer; }
button.blog-card-authorname:hover { color: var(--whimle-blue, #38b6ff); text-decoration: underline; }
.blog-card-date { color: #888; font-size: 12px; margin-left: auto; }
.blog-badge {
  font-size: 11px; font-weight: 800; color: #04223a;
  background: var(--whimle-blue, #38b6ff); border-radius: 6px; padding: 2px 7px;
}
.blog-badge--draft { background: #f0c419; }
.blog-card-title { margin: 6px 0 4px; font-size: 20px; }
.blog-card-title button { font: inherit; font-weight: 800; color: #14323f; background: none; border: none; padding: 0; cursor: pointer; text-align: left; }
.blog-card-title button:hover { color: var(--whimle-blue, #38b6ff); }
.blog-card-desc { margin: 0 0 8px; color: #555; font-size: 14px; line-height: 1.5; }
.blog-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.blog-cardtag { font-size: 11px; font-weight: 600; color: #000; background: var(--whimle-lime-soft, rgba(51,204,51,.18)); border-radius: 999px; padding: 2px 9px; }
.blog-card-counts { font-size: 12px; color: #777; margin-left: auto; }
.blog-hint { color: #04223a; font-size: 13px; }

/* ---- pager ---- */
.blog-pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0 4px; }
.blog-pager-btn { width: auto; padding: 6px 14px; font-size: 13px; }
.blog-pager-label { font-size: 13px; color: #04223a; font-weight: 600; }

/* ---- post view ---- */
.blog-back { display: inline-block; font-size: 14px; font-weight: 700; color: #04223a; text-decoration: none; margin-bottom: 10px; }
.blog-back:hover { text-decoration: underline; color: #fff; }
.blog-post-title { margin: 4px 0 8px; font-size: 26px; color: #04223a; }
/* post-page chrome sits straight on the blue — darken its inks */
.blog-postview .blog-card-date, .blog-postview .blog-card-counts { color: #064a73; }
.blog-postview .blog-card-authorname { color: #04223a; }
.blog-editor .whimle-label, .blog-editor .blog-files-hint { color: #04223a; }
.blog-editor .blog-file-size { color: #4a6b7d; }
.blog-editlink { font-size: 13px; font-weight: 700; color: #04223a; text-decoration: underline; }
.blog-editlink:hover { text-decoration: underline; }
.blog-frame-wrap { margin: 14px 0; }
.blog-frame {
  width: 100%; min-height: 60vh; background: #fff;
  border: 2px solid #000; border-radius: 12px;
}
.blog-reactions { display: flex; align-items: center; gap: 10px; }
.blog-reactbtn {
  font: inherit; font-size: 14px; font-weight: 700; color: #333;
  background: #fff; border: 2px solid #000; border-radius: 10px;
  padding: 7px 14px; cursor: pointer;
}
.blog-reactbtn:hover { background: var(--whimle-blue-soft, rgba(56,182,255,.18)); }
.blog-reactbtn--on { background: var(--whimle-lime-soft, rgba(51,204,51,.25)); border-color: var(--whimle-lime, #33CC33); }
.blog-react-msg { font-size: 12px; color: var(--whimle-error, #c0392b); }

/* ---- discussion (flat comments) ---- */
.blog-discussion { margin-top: 26px; border-top: 2px solid #000; padding-top: 14px; }
.blog-discussion-title { margin: 0 0 12px; font-size: 19px; color: #04223a; }
.blog-composer-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 16px; }
.blog-composer-input { flex: 1; min-width: 220px; resize: vertical; font-size: 14px; }
.blog-composer-send { width: auto; padding: 9px 16px; }
.blog-composer-login { width: auto; padding: 9px 16px; margin-bottom: 14px; }
/* inline text link used inside hints (e.g. the guest "make an account" nudge) */
.blog-linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--whimle-blue, #38b6ff); font-weight: 700; text-decoration: underline; }
.blog-guesthint, .blog-composer [data-testid="comment-guesthint"] { margin: 2px 0 14px; }
.blog-comments { display: flex; flex-direction: column; gap: 10px; }
.blog-comment { background: #fff; border: 1px solid #bbb; border-radius: 10px; padding: 10px 12px; }
.blog-comment-body { font-size: 14px; color: #1a1a1a; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 6px 0; }
.blog-comment-foot { display: flex; gap: 8px; }
.blog-reactbtn--sm { font-size: 12px; padding: 4px 10px; border-width: 1px; }
.blog-comment-x { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 14px; padding: 2px 6px; line-height: 1; }
.blog-comment-x:hover { color: #e74c3c; }

/* ---- editor ---- */
/* One pane at a time, full width — switched by the tab bar (no more
   three squished columns). data-active on the wrap picks the visible pane. */
.blog-editor-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.blog-editor-tab {
  flex: 1; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  padding: 10px 12px; border: 2px solid #000; border-radius: 10px;
  background: #fff; color: #04223a; transition: .15s; min-width: 0;
}
.blog-editor-tab:hover { border-color: var(--whimle-blue, #38b6ff); }
.blog-editor-tab.is-active { background: var(--whimle-blue, #38b6ff); color: #04223a; }
.blog-editor-panes > .blog-editor-pane { display: none; }
.blog-editor-panes[data-active="files"]   > [data-pane="files"],
.blog-editor-panes[data-active="code"]    > [data-pane="code"],
.blog-editor-panes[data-active="preview"] > [data-pane="preview"] { display: block; }

/* the "save a draft first" nudge shown on brand-new (unsaved) posts */
.blog-files-note {
  background: var(--whimle-blue-soft, rgba(56, 182, 255, 0.16));
  border: 1px solid var(--whimle-blue, #38b6ff);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
  color: #14323f;
  line-height: 1.5;
  margin: 0 0 12px;
}

/* files pane */
.blog-files { background: #fff; border: 2px solid #000; border-radius: 12px; padding: 10px; align-self: start; }
.blog-files-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.blog-files-head .whimle-label { flex: 1; }
.blog-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.blog-files-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow-y: auto; }
.blog-file-row { display: flex; align-items: center; gap: 6px; border-radius: 7px; padding: 3px 6px; }
.blog-file-row--on { background: var(--whimle-blue-soft, rgba(56,182,255,.18)); }
.blog-file-name {
  font: inherit; font-size: 12px; font-family: ui-monospace, Menlo, monospace;
  background: none; border: none; padding: 2px 0; cursor: pointer; color: #1a3a4a;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
}
.blog-file-name:hover { color: var(--whimle-blue, #38b6ff); }
.blog-file-size { font-size: 11px; color: #999; flex-shrink: 0; }
.blog-files-hint { font-size: 11px; color: #888; margin: 8px 0 0; line-height: 1.5; }
.blog-files-hint code { background: #eef3f6; border-radius: 4px; padding: 0 4px; }
/* folder navigation: breadcrumb + New-folder + folder rows */
.blog-files-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 6px;
  padding-bottom: 6px; border-bottom: 1px solid var(--rule, #e3dac8); }
.blog-crumb { font: inherit; font-size: 12px; font-weight: 700; background: none; border: none; cursor: pointer;
  color: var(--whimle-blue, #38b6ff); padding: 1px 4px; border-radius: 5px; }
.blog-crumb:hover { background: var(--whimle-blue-soft, rgba(56,182,255,.18)); }
.blog-crumb-sep { color: #aaa; font-size: 12px; }
.blog-newfolder { margin-left: auto; font-size: 12px; }
.blog-folder-row .blog-folder-name { font-weight: 700; color: #1a3a4a; }
.blog-folder-row:hover { background: var(--whimle-blue-soft, rgba(56,182,255,.12)); }
/* drop-to-upload highlight on the Files pane */
.blog-files.blog-files--drop { outline: 3px dashed var(--whimle-blue, #38b6ff); outline-offset: -3px; background: var(--whimle-blue-soft, rgba(56,182,255,.10)); }
/* upload progress bar (% from the XHR upload events) */
.blog-upload-prog { margin: 8px 0 2px; }
.blog-upload-bar { height: 8px; border-radius: 999px; background: #e3eef4; overflow: hidden; }
.blog-upload-fill { height: 100%; width: 0; border-radius: 999px; background: var(--whimle-blue, #38b6ff); transition: width .15s ease; }
.blog-upload-label { font-size: 11px; color: #4a6b7d; margin-top: 4px; font-weight: 700; }

/* insert toolbar */
.blog-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.blog-tool {
  font: inherit; font-size: 12px; font-weight: 600; color: #333;
  background: #fff; border: 1px solid #999; border-radius: 7px;
  padding: 4px 9px; cursor: pointer;
}
.blog-tool:hover { border-color: var(--whimle-lime, #33CC33); background: var(--whimle-lime-soft, rgba(51,204,51,.12)); }
.blog-editor-pane { min-width: 0; }
.blog-editor-code {
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  min-height: 64vh; resize: vertical; white-space: pre; overflow: auto;
}
.blog-frame--preview { min-height: 64vh; height: 100%; }
.blog-files-list { max-height: 64vh; }
.blog-editor-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.blog-editor-actions .whimle-btn { width: auto; padding: 9px 16px; }
.wa-danger { background: #e74c3c; color: #fff; }

/* ---- account slide-over ---- */
.blog-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(6, 24, 36, 0.55);
}
.blog-drawer-backdrop[hidden] { display: none; }
.blog-drawer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(360px, 92vw);
  background: #fff;
  border-left: 2px solid #000;
  padding: 44px 16px 16px;
  overflow-y: auto;
}
.blog-drawer-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: #555;
}
.blog-drawer-close:hover { color: #000; }
