/* ============================================================
   MiniBlog — LiveJournal / mid-2000s blog aesthetic
   Colors driven by CSS custom properties (see header.php)
   ============================================================ */

:root {
  /* Theme palette — overridden by PHP-generated <style> in <head> */
  --c:      #4a7ea5;
  --c-dk:   #3d6e92;
  --c-dkr:  #2a5070;
  --c-lt:   #7aaac8;
  --c-bg:   #f0f4f8;
  --c-txt:  #1a3a5c;
  --c-h1:   #5890ba;
  --c-h2:   #3d6e92;
  --c-bdr:  #b8d4e8;
  --c-tbl:  #dde8f0;
  /* Base (non-themed) */
  --bg:     #e8e8e0;
  --surface:#ffffff;
  --border: #cccccc;
  --text:   #333333;
  --text2:  #555555;
  --text3:  #888888;
  --font:   Verdana, Geneva, Arial, sans-serif;
  --mono:   'Courier New', Courier, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}

img { max-width: 100%; height: auto; display: block; }
a         { color: var(--c); text-decoration: none; }
a:visited { color: color-mix(in srgb, var(--c) 60%, #609 40%); }
a:hover   { text-decoration: underline; }

/* ---- Cover -------------------------------------------------------- */

.site-cover {
  width: 100%; max-height: 220px; object-fit: cover;
  display: block; border-bottom: 1px solid var(--c-dkr);
}
.site-cover--placeholder { height: 40px; background: var(--c-dk); border-bottom: 1px solid var(--c-dkr); }

/* ---- Header ------------------------------------------------------- */

.site-header {
  background: var(--c);
  background-image: linear-gradient(to bottom, var(--c-h1), var(--c-h2));
  border-bottom: 2px solid var(--c-dkr);
}
.site-header__inner {
  max-width: 860px; margin: 0 auto;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.site-logo {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px; font-style: italic;
  color: #fff; text-decoration: none;
  text-shadow: 1px 1px 2px rgba(0,0,0,.4);
}
.site-logo:hover   { color: #d0e8ff; text-decoration: none; }
.site-logo:visited { color: #fff; }
.site-tagline { font-size: 11px; color: rgba(255,255,255,.65); margin-left: 8px; font-style: italic; }

/* ---- Layout ------------------------------------------------------- */

.layout {
  max-width: 860px; margin: 12px auto;
  padding: 0 10px;
  display: grid; grid-template-columns: 1fr 210px; gap: 12px; align-items: start;
}
@media (max-width: 680px) { .layout { grid-template-columns: 1fr; } .sidebar { order: -1; } }

/* ---- Post cards --------------------------------------------------- */

.posts-grid { display: flex; flex-direction: column; gap: 10px; }

.post-card { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c); }
.post-card:hover { border-top-color: var(--c-dk); }

.post-card__cover { width: 100%; max-height: 180px; object-fit: cover; border-bottom: 1px solid #ddd; }
.post-card__body  { padding: 10px 12px; }
.post-card__meta  { font-size: 11px; color: var(--text3); margin-bottom: 5px; }
.post-card__title { font-family: Georgia, serif; font-size: 16px; font-weight: bold; line-height: 1.3; margin-bottom: 5px; }
.post-card__title a       { color: var(--c-txt); }
.post-card__title a:hover { color: var(--c); text-decoration: underline; }
.post-card__excerpt { font-size: 12px; color: var(--text2); line-height: 1.55; }
.post-card__footer {
  padding: 5px 12px; background: #f5f5f0; border-top: 1px solid #e0e0d8;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text3);
}
.read-more { font-weight: bold; color: var(--c); font-size: 11px; }
.read-more:hover { text-decoration: underline; }

/* ---- Pagination --------------------------------------------------- */

.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-block; min-width: 26px; padding: 3px 7px;
  border: 1px solid #bbb; background: #f0f0e8;
  font-size: 11px; text-align: center; color: var(--c); text-decoration: none;
}
.pagination a:hover  { background: var(--c-bg); border-color: var(--c); text-decoration: none; }
.pagination .active  { background: var(--c); color: #fff; border-color: var(--c-dkr); font-weight: bold; }

/* ---- Single post -------------------------------------------------- */

.post-single { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c); }
.post-cover  { width: 100%; max-height: 320px; object-fit: cover; border-bottom: 1px solid #ddd; }
.post-header { padding: 12px 14px 8px; background: #f5f5f0; border-bottom: 1px solid #ddd; }
.post-title  { font-family: Georgia, serif; font-size: clamp(17px, 3vw, 22px); font-weight: bold; color: var(--c-txt); margin-bottom: 5px; line-height: 1.3; }
.post-meta   { font-size: 11px; color: var(--text3); display: flex; flex-wrap: wrap; gap: 10px; }
.post-content { padding: 12px 14px 16px; font-size: 13px; line-height: 1.7; color: var(--text); }

@media (max-width: 600px) { .post-header, .post-content { padding-left: 10px; padding-right: 10px; } }

/* Rich text */
.post-content h1 { font-family: Georgia, serif; font-size: 19px; color: var(--c-txt); border-bottom: 1px solid #ccc; padding-bottom: 4px; margin: 16px 0 7px; }
.post-content h2 { font-family: Georgia, serif; font-size: 16px; color: var(--c-txt); border-bottom: 1px solid #e0e0d8; padding-bottom: 3px; margin: 14px 0 6px; }
.post-content h3 { font-size: 14px; font-weight: bold; color: var(--c-dk); margin: 12px 0 5px; }
.post-content h4 { font-size: 13px; font-weight: bold; margin: 10px 0 4px; }
.post-content p  { margin-bottom: 9px; }
.post-content ul, .post-content ol { margin: 6px 0 8px 22px; }
.post-content li { margin-bottom: 3px; }
.post-content blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--c); background: var(--c-bg); color: var(--text2); font-style: italic; }
.post-content a         { color: var(--c); }
.post-content a:visited { color: color-mix(in srgb, var(--c) 60%, #609 40%); }
.post-content img       { max-width: 100%; border: 1px solid #ccc; margin: 8px 0; }
.post-content iframe    { width: 100%; aspect-ratio: 16/9; border: 1px solid #ccc; margin: 8px 0; }
.post-content pre {
  background: #282828; color: #d4d4d4; border: 1px solid #555;
  padding: 10px; overflow-x: auto; margin: 10px 0;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
}
.post-content pre code { font-family: var(--mono); background: none; color: inherit; padding: 0; font-size: 12px; }
.post-content code { font-family: var(--mono); font-size: 12px; background: #f4f0e8; border: 1px solid #ddd; padding: 1px 4px; color: #880000; }
.post-content table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.post-content th, .post-content td { padding: 5px 8px; border: 1px solid #ccc; text-align: left; }
.post-content th { background: var(--c-tbl); color: var(--c-txt); font-weight: bold; }
.post-content tr:nth-child(even) td { background: #f8f8f4; }
.post-content hr { border: none; border-top: 1px solid #ddd; margin: 14px 0; }
.post-content video { width: 100%; border: 1px solid #ccc; margin: 8px 0; }

/* ---- Comments ----------------------------------------------------- */

.comments-section { margin-top: 10px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c); }
.comments-title {
  font-size: 12px; font-weight: bold; color: #fff;
  background: var(--c); padding: 5px 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.comment { display: flex; gap: 9px; padding: 8px 12px; border-bottom: 1px solid #eee; }
.comment:last-of-type { border-bottom: none; }

.comment-avatar {
  width: 32px; height: 32px; background: var(--c); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 12px; flex-shrink: 0; border: 1px solid var(--c-dkr);
}
.comment-body   { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 3px; }
.comment-author { font-weight: bold; font-size: 12px; color: var(--c-txt); }
.comment-date   { font-size: 11px; color: var(--text3); }
.comment-text   { font-size: 12px; line-height: 1.55; color: #444; word-break: break-word; }
.comment-reply-btn {
  background: none; border: none; color: var(--c);
  font-size: 11px; font-family: var(--font); cursor: pointer; padding: 0; margin-top: 3px; text-decoration: underline;
}
.comment-reply-btn:hover { color: var(--c-dk); }

.comment-replies { margin-top: 6px; margin-left: 12px; border-left: 2px solid var(--c-bdr); padding-left: 10px; }
.comment-replies .comment { padding: 5px 0; }
.comment-replies .comment-avatar { width: 26px; height: 26px; font-size: 10px; background: var(--c-lt); border-color: var(--c); }

.comment-form-wrap { padding: 10px 12px; background: #f5f5f0; border-top: 1px solid #ddd; }
.comment-form-wrap h3 {
  font-size: 12px; font-weight: bold; color: var(--c-txt);
  margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #ddd;
  text-transform: uppercase; letter-spacing: 0.4px;
}

.form-group       { margin-bottom: 7px; }
.form-group label { display: block; font-size: 11px; font-weight: bold; margin-bottom: 2px; color: #444; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 4px 6px; border: 1px solid #bbb;
  background: #fff; font-family: var(--font); font-size: 12px; color: var(--text);
}
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--c); background: var(--c-bg); }
.form-group textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.captcha-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.captcha-question { font-size: 12px; font-weight: bold; background: #fff8d0; border: 1px solid #ccaa44; padding: 2px 8px; color: #664400; }
.captcha-row input { max-width: 70px; }

.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border: 1px solid var(--c-dkr);
  background: var(--c-bg); font-family: var(--font);
  font-size: 12px; cursor: pointer; color: var(--c-txt); text-decoration: none; line-height: 1.4;
}
.btn:hover      { background: var(--c-tbl); text-decoration: none; color: var(--c-txt); }
.btn-primary    { background: var(--c); color: #fff; border-color: var(--c-dkr); }
.btn-primary:hover { background: var(--c-dk); color: #fff; }
.btn-secondary  { background: #f0f0e8; color: #444; border-color: #bbb; }
.btn-secondary:hover { background: #e0e0d8; }
.btn-danger     { background: #c44; color: #fff; border-color: #a22; }
.btn-danger:hover { background: #a22; color: #fff; }

.reply-form-inline { margin-top: 6px; background: var(--c-bg); border: 1px solid var(--c-bdr); padding: 8px 10px; }
.reply-form-inline textarea { min-height: 60px; }

/* ---- Alert -------------------------------------------------------- */

.alert { padding: 6px 10px; border: 1px solid; font-size: 12px; margin-bottom: 8px; }
.alert-success { background: #e8f8e8; border-color: #88bb88; color: #336633; }
.alert-error   { background: #fce8e8; border-color: #cc8888; color: #881111; }
.alert-info    { background: var(--c-bg); border-color: var(--c-bdr); color: var(--c-txt); }

/* ---- Sidebar ------------------------------------------------------ */

.sidebar { display: flex; flex-direction: column; gap: 8px; }

.sidebar-profile,
.sidebar-section {
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c);
}

.sidebar-profile { text-align: center; padding: 10px 8px; }

.profile-photo { width: 76px; height: 76px; object-fit: cover; border: 2px solid var(--c); margin: 0 auto 7px; }
.profile-photo--placeholder { display: flex; align-items: center; justify-content: center; background: var(--c-bg); }
.profile-photo--placeholder svg { width: 44px; height: 44px; color: var(--c); }

.sidebar-name { font-family: Georgia, serif; font-size: 14px; font-weight: bold; color: var(--c-txt); margin-bottom: 5px; }
.sidebar-bio  { font-size: 11px; color: var(--text2); line-height: 1.55; text-align: left; }

.sidebar-section-title {
  display: block; font-size: 10px; font-weight: bold;
  text-transform: uppercase; letter-spacing: 0.6px;
  background: var(--c); color: #fff; padding: 4px 8px;
}

.social-links { list-style: none; padding: 4px 0; }
.social-link { display: flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 11px; color: var(--c); border-bottom: 1px dotted #e0e0d8; }
.social-link:last-child { border-bottom: none; }
.social-link:hover { background: var(--c-bg); text-decoration: none; color: var(--c-dk); }
.social-icon { width: 14px; height: 14px; flex-shrink: 0; }
.social-icon svg { width: 100%; height: 100%; }

/* Recent posts widget */
.sidebar-posts { list-style: none; padding: 4px 0; }
.sidebar-post  { padding: 4px 8px; border-bottom: 1px dotted #e0e0d8; font-size: 11px; }
.sidebar-post:last-child { border-bottom: none; }
.sidebar-post a { color: var(--c); display: block; line-height: 1.4; margin-bottom: 1px; }
.sidebar-post a:hover { text-decoration: underline; }
.sidebar-post-date { font-size: 10px; color: var(--text3); display: block; }

.sidebar-gallery { display: grid; grid-template-columns: repeat(3,1fr); gap: 3px; padding: 5px; }
.gallery-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid #ccc; }
.gallery-thumb:hover img { opacity: .82; }

/* ---- Clone button ------------------------------------------------- */

.clone-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; background: var(--c); color: #fff;
  font-size: 11px; font-weight: bold; border: 1px solid var(--c-dkr);
  text-decoration: none; width: 100%;
}
.clone-btn:hover { background: var(--c-dk); color: #fff; text-decoration: none; }
.clone-btn:visited { color: #fff; }
.clone-btn__icon { width: 14px; height: 14px; flex-shrink: 0; }

/* ---- Footer ------------------------------------------------------- */

.site-footer { text-align: center; padding: 10px; font-size: 11px; color: #888; border-top: 1px solid #bbb; background: var(--bg); margin-top: 14px; }

/* ---- Empty state -------------------------------------------------- */

.empty-state { background: var(--surface); border: 1px solid var(--border); text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 8px; color: #aaa; }
.empty-state h2  { font-family: Georgia, serif; font-size: 16px; margin-bottom: 5px; color: var(--text2); }

/* ---- Back link ---------------------------------------------------- */

.back-link { display: inline-block; font-size: 11px; color: var(--c); margin-bottom: 7px; }
.back-link:hover { text-decoration: underline; }
