/* ==========================================================================
   JUNK DRAWER. Flat, unstyled-on-purpose: stuff just placed on a dark field.
   No panels, no borders, no shadows. Plain text, scattered. The look comes
   from placement, not decoration.
   ========================================================================== */

:root {
  --bg:      #282A36;   /* page */
  --main:    #70ff98;   /* big name */
  --header:  #8080F7;   /* aka line + section labels */
  --link:    #6bcdd9;   /* hyperlinks + captions */
  --subtext: #80879e;   /* body + secondary text */
  --center-w: 560px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--subtext);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

a, a:visited { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Side zones: absolute, things float independently of the flow ------- */
.junk-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: calc((100% - var(--center-w)) / 2);
  z-index: 1;
  pointer-events: none;
}
#left-zone  { left: 0; }
#right-zone { right: 0; }

.junk {
  position: absolute;
  margin: 0; padding: 0;
  pointer-events: auto;
  text-align: center;
}
.junk-media { display: block; max-width: 150px; height: auto; }
/* Caption is real DOM the whole time but only shows as a box on hover. */
.junk .cap {
  position: absolute;
  left: 50%; top: 100%;
  transform: translateX(-50%);
  margin-top: 4px;
  padding: 2px 6px;
  background: #1f212c;
  border: 1px solid var(--link);
  color: var(--link);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 5;
}
.junk:hover .cap { opacity: 1; }
.junk .cap-date { color: var(--subtext); font-size: 11px; }
.junk-text { color: var(--link); font-size: 16px; white-space: nowrap; }
.junk-text:hover { text-decoration: underline; }
body.search-active .search-dim {
  opacity: 0.16;
  transition: opacity 0.12s;
}
body.search-active .search-hit {
  opacity: 1;
}

/* Selection transform box + corner resize handles (shown when an item is
   selected in edit mode). */
.junk.selected { outline: 1px solid var(--link); outline-offset: 2px; }
.resize-handle {
  position: absolute;
  width: 11px; height: 11px;
  background: var(--link);
  border: 1px solid var(--bg);
  z-index: 85;
  touch-action: none;
}
.resize-handle.nw { left: -6px;  top: -6px;    cursor: nwse-resize; }
.resize-handle.ne { right: -6px; top: -6px;    cursor: nesw-resize; }
.resize-handle.sw { left: -6px;  bottom: -6px; cursor: nesw-resize; }
.resize-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.sel-tools {
  position: absolute; left: 0; top: -24px; z-index: 86;
  display: flex; gap: 4px;
}
.sel-tools button {
  font: inherit; font-size: 12px; cursor: pointer; line-height: 1.4;
  background: #1f212c; color: var(--link);
  border: 1px solid var(--link); padding: 1px 6px;
}
.sel-tools button:hover { background: var(--link); color: var(--bg); }

/* ---- Center column: normal flow, so dropdowns push siblings for free ---- */
.center {
  position: relative;
  z-index: 2;
  width: var(--center-w);
  max-width: calc(100% - 24px);
  margin: 22px auto 90px;
}

/* ---- Header ------------------------------------------------------------- */
.site-head { text-align: center; }
.site-name {
  margin: 0;
  color: var(--main);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.site-aliases { margin: 6px 0 0; color: var(--header); font-size: 18px; }
.me-rn { margin-top: 16px; text-align: center; }
.me-rn-label { color: var(--header); }
.inline-edit {
  margin-left: 6px; font: inherit; font-size: 13px; cursor: pointer;
  background: transparent; color: var(--link);
  border: 1px solid var(--link); padding: 1px 6px;
}
.inline-edit:hover { background: var(--link); color: var(--bg); }
[contenteditable="true"] { outline: 1px dotted transparent; cursor: text; }
[contenteditable="true"]:hover { outline-color: var(--header); }
[contenteditable="true"]:focus { outline: 1px dashed var(--link); }
.me-rn-img { display: block; margin: 8px auto 0; max-height: 160px; width: auto; }
.me-rn-placeholder { display: block; margin-top: 6px; color: var(--subtext); font-size: 14px; }

/* ---- Search: tiny, out of the way, top-right ---------------------------- */
.searchbox {
  position: fixed;
  top: 8px;
  right: 10px;
  z-index: 20;
  width: 180px;
  text-align: right;
  margin: 0;
}
#search-input {
  width: 120px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--subtext);
  color: var(--subtext);
  font: inherit;
  font-size: 12px;
  padding: 1px 2px;
  text-align: right;
}
#search-input::placeholder { color: var(--subtext); opacity: 0.7; }
#search-input:focus { outline: none; border-bottom-color: var(--link); }
.search-results {
  list-style: none;
  margin: 5px 0 0 auto;
  padding: 4px 6px;
  width: 180px;
  max-height: 45vh;
  overflow: auto;
  background: #1f212c;
  border: 1px solid #3a3d4f;
  text-align: left;
}
.search-results:empty { display: none; }
.search-results li { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 12px; }
.search-results img { width: 22px; height: 22px; object-fit: cover; }
.search-results .cap { flex: 1; color: var(--link); }
.search-results .role { font-size: 11px; color: var(--subtext); }
.search-empty { color: var(--subtext); font-size: 12px; }

/* ---- Focused image overlay --------------------------------------------- */
.image-focus {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 24px;
}
.image-focus-inner {
  max-width: min(92vw, 900px);
  max-height: 92vh;
  text-align: center;
}
.image-focus img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  margin: 0 auto;
}
.image-focus p {
  margin: 8px auto 0;
  color: var(--link);
  background: #1f212c;
  border: 1px solid var(--link);
  padding: 3px 8px;
  width: max-content;
  max-width: 100%;
}
.image-focus p:empty { display: none; }
.image-focus-x {
  position: fixed;
  top: 12px;
  right: 14px;
  font: inherit;
  cursor: pointer;
  color: var(--link);
  background: #1f212c;
  border: 1px solid var(--link);
}

/* ---- Dropdowns: plain bulleted list, no chrome -------------------------- */
.drawers { margin-top: 22px; }
.drawer { margin: 0; }
.drawer > summary {
  list-style: none;
  cursor: pointer;
  color: var(--header);
  padding: 3px 0;
}
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary::before { content: "\25B2\00a0"; font-size: 12px; }
.drawer[open] > summary::before { content: "\25BC\00a0"; }
.drawer > summary:hover { color: var(--link); }
.drawer-body { padding: 4px 0 10px 18px; color: var(--subtext); }

/* Inline "+" / edit buttons living inside a <summary>. */
.sec-add {
  font: inherit; font-size: 13px; cursor: pointer;
  background: transparent; color: var(--link);
  border: 1px solid var(--link); padding: 0 6px; margin-left: 6px;
}
.sec-add:hover { background: var(--link); color: var(--bg); }

/* Section item lists (watchlist / socials). */
.sec-list { list-style: none; margin: 0; padding: 0; }
.sec-item { padding: 2px 0; }
.sec-item a { color: var(--link); }
.sec-media { display: block; max-width: 140px; height: auto; margin: 4px 0; }
.sec-cap { display: block; font-size: 13px; color: var(--subtext); }
body.editing .sec-item { outline: 1px dashed var(--header); cursor: pointer; padding-left: 4px; }
.section-doc {
  min-height: 1.4em;
  color: var(--subtext);
  white-space: normal;
}
.section-doc:empty::before {
  content: "";
}
.section-doc p {
  margin: 0 0 4px;
}
.section-doc div {
  margin: 0 0 4px;
}
.section-doc a {
  color: var(--link);
}
body.editing .section-doc {
  min-height: 70px;
  outline: 1px dashed var(--header);
  padding: 4px 6px;
  cursor: text;
}
body.editing .section-doc a {
  cursor: text;
}
body.editing .section-doc:empty::before {
  content: "type here";
  color: var(--subtext);
  opacity: 0.55;
}

/* ---- Blog --------------------------------------------------------------- */
.blog-nav { margin: 4px 0 10px; }
.blog-step {
  background: none; border: 0; cursor: pointer;
  color: var(--link); font: inherit; padding: 0 6px;
}
.blog-step:disabled { color: var(--subtext); opacity: 0.5; cursor: default; }
#blog-date {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--subtext);
  border-radius: 0;
  color: var(--subtext);
  font: inherit;
  font-style: italic;
  padding: 0 2px;
}
#blog-date:focus {
  outline: none;
  border-bottom-color: var(--link);
}
#blog-date::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}
.post-title { margin: 6px 0; color: var(--header); font-size: 20px; font-weight: 600; }
.post-body { color: var(--subtext); line-height: 1.55; }
.post-body::after { content: ""; display: block; clear: both; }
.post-body a { color: var(--link); }
.post-meta { margin-top: 12px; color: var(--subtext); font-size: 14px; font-style: italic; }
.post-empty { color: var(--subtext); }
.post-edit-shell { display: none; }
body.editing .post-edit-shell { display: block; }
body.editing .post-empty { display: none; }
body.editing .post-title {
  min-height: 1.5em;
  padding: 3px 5px;
  outline: 1px dashed var(--header);
}
body.editing .post-body {
  min-height: 130px;
  padding: 6px 7px;
  outline: 1px dashed #3a3d4f;
}
body.editing .post-title:focus,
body.editing .post-body:focus {
  outline-color: var(--link);
}
body.editing .post-title:empty::before {
  content: attr(data-placeholder);
  color: var(--subtext);
  opacity: 0.55;
}
body.editing .post-body:empty::before {
  content: attr(data-placeholder);
  color: var(--subtext);
  opacity: 0.55;
}

/* In-post images keep float-based wrapping. */
.post-img { max-width: 100%; height: auto; }
.post-img.left  { float: left;  margin: 4px 16px 8px 0; }
.post-img.right { float: right; margin: 4px 0 8px 16px; }
.post-img.center { display: block; float: none; margin: 12px auto; }

/* ---- Footer ------------------------------------------------------------- */
.site-foot { margin-top: 28px; font-size: 14px; color: var(--subtext); }
.inline { display: inline; }
.linkbtn {
  background: none; border: 0; padding: 0;
  color: var(--link); font: inherit; cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; }

/* ==========================================================================
   Admin: same flat palette, just functional. Kept plain.
   ========================================================================== */
.admin { max-width: 860px; margin: 30px auto; padding: 0 16px 80px; position: relative; z-index: 2; }
.admin h1 { color: var(--main); font-weight: 600; }
.admin h2 { color: var(--header); margin-top: 0; font-size: 20px; }
.admin .panel { border-top: 1px solid #3a3d4f; padding: 16px 0; margin-bottom: 8px; }
.admin label { display: block; color: var(--header); font-size: 14px; margin: 12px 0 4px; }
.admin input[type=text], .admin input[type=date], .admin input[type=password],
.admin textarea, .admin select {
  width: 100%; font: inherit;
  background: #1f212c; color: var(--subtext);
  border: 1px solid #3a3d4f; padding: 7px 9px;
}
.admin textarea { min-height: 90px; }
.admin input:focus, .admin textarea:focus, .admin select:focus { outline: none; border-color: var(--link); }
.admin .btn, .admin button {
  font: inherit; cursor: pointer;
  background: #1f212c; color: var(--link);
  border: 1px solid var(--link); padding: 6px 12px;
}
.admin .btn:hover, .admin button:hover { background: var(--link); color: var(--bg); }
.admin .danger { color: #ff7a90; border-color: #ff7a90; }
.admin .danger:hover { background: #ff7a90; color: var(--bg); }
.admin table { width: 100%; border-collapse: collapse; }
.admin th, .admin td { border: 1px solid #3a3d4f; padding: 6px; text-align: left; vertical-align: middle; font-size: 14px; }
.admin th { color: var(--header); }
.admin .thumb { width: 52px; height: 52px; object-fit: cover; }
.admin .row { display: flex; gap: 12px; flex-wrap: wrap; }
.admin .row > * { flex: 1; min-width: 220px; }
.admin a { color: var(--link); }
.admin code { color: var(--subtext); }
.loginwrap { max-width: 320px; margin: 14vh auto; }
.err { color: #ff7a90; }
.linkbtn { color: var(--link); }

/* Editor surface */
.editor-bar { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
#editor {
  background: #1f212c; color: var(--subtext);
  border: 1px solid #3a3d4f; padding: 14px; min-height: 240px; line-height: 1.6;
}
#editor:focus { outline: none; border-color: var(--link); }
#editor .post-img { cursor: grab; }
.hint { font-size: 13px; color: var(--subtext); }

/* ==========================================================================
   On-page edit mode (admin only).
   ========================================================================== */
/* Floating, draggable edit box (moved by its head bar; JS sets left/top). */
#admin-toolbar {
  position: fixed; top: 12px; left: 12px; z-index: 60;
  width: max-content; max-width: 280px;
  background: #1f212c; border: 1px solid var(--link);
  font-size: 14px; color: var(--subtext);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
#admin-toolbar .tb-head {
  cursor: move; padding: 5px 10px; touch-action: none;
  background: var(--bg); border-bottom: 1px solid var(--link);
  color: var(--header); user-select: none;
}
#admin-toolbar .tb-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
#admin-toolbar .tb-row { display: flex; gap: 6px; flex-wrap: wrap; }
#admin-toolbar .theme-row { display: flex; gap: 6px; align-items: center; }
#admin-toolbar .theme-row input {
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid #3a3d4f;
  background: transparent;
  cursor: pointer;
}
#admin-toolbar button {
  font: inherit; cursor: pointer;
  background: transparent; color: var(--link);
  border: 1px solid var(--link); padding: 3px 9px;
}
#admin-toolbar button:hover { background: var(--link); color: var(--bg); }
#admin-toolbar .tb-hint { color: var(--subtext); opacity: 0.8; font-size: 12px; }

/* In edit mode every junk item is grabbable and outlined. */
body.editing .junk-zone { pointer-events: auto; }
body.editing .junk {
  outline: 1px dashed var(--header);
  cursor: grab;
  pointer-events: auto;
}
body.editing .junk-text { cursor: grab; }       /* don't follow links while editing */
.junk.dragging { z-index: 80; opacity: 0.85; cursor: grabbing; outline: 1px solid var(--link); }

body.editing .sec-item { cursor: text; }
body.editing .sec-item a { cursor: text; }
body.editing [data-inline-label]:focus,
body.editing #blog-post [contenteditable="true"]:focus {
  outline: 1px dashed var(--link);
}

/* Edit popover — draggable by its head bar (JS sets left/top). */
.editor-pop {
  position: fixed; z-index: 90; width: min(360px, 92vw);
  background: #1f212c; border: 1px solid var(--link);
  display: flex; flex-direction: column;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.editor-pop .pop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; cursor: move;
  background: var(--bg); border-bottom: 1px solid #3a3d4f;
  touch-action: none;
}
.editor-pop .pop-title { color: var(--header); font-size: 15px; }
.editor-pop .pop-x {
  font: inherit; cursor: pointer; line-height: 1;
  background: transparent; color: var(--subtext); border: 0; padding: 0 4px;
}
.editor-pop .pop-x:hover { color: var(--link); }
.editor-pop .pop-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.editor-pop .pop-lab { color: var(--header); font-size: 13px; margin-bottom: -4px; }
.editor-pop input, .editor-pop .pop-editor {
  font: inherit; background: var(--bg); color: var(--subtext);
  border: 1px solid #3a3d4f; padding: 7px 9px;
}
.editor-pop input:focus, .editor-pop .pop-editor:focus { outline: none; border-color: var(--link); }
.editor-pop .pop-editor { min-height: 120px; max-height: 50vh; overflow: auto; line-height: 1.5; }
.editor-pop .pop-editor .post-img { max-width: 100%; }
.editor-pop .pop-editor .post-img.left { float: left; margin: 2px 10px 6px 0; max-width: 45%; }
.editor-pop .pop-editor .post-img.right { float: right; margin: 2px 0 6px 10px; max-width: 45%; }
.editor-pop .pop-editor .post-img.center { display: block; float: none; margin: 8px auto; }
.editor-pop .pop-toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.editor-pop .pop-toolbar button {
  font: inherit; font-size: 13px; cursor: pointer;
  background: transparent; color: var(--link);
  border: 1px solid #3a3d4f; padding: 3px 7px;
}
.editor-pop .pop-toolbar button:hover { border-color: var(--link); }
.editor-pop .pop-row { display: flex; gap: 8px; padding: 0 12px 12px; }
.editor-pop .pop-row button {
  font: inherit; cursor: pointer; flex: 1;
  background: transparent; color: var(--link);
  border: 1px solid var(--link); padding: 5px 8px;
}
.editor-pop .pop-row button:hover { background: var(--link); color: var(--bg); }
.editor-pop .pop-row .danger { color: #ff7a90; border-color: #ff7a90; }
.editor-pop .pop-row .danger:hover { background: #ff7a90; color: var(--bg); }

@media (max-width: 920px) {
  .junk-zone { display: none; }   /* no room to scatter */
}
