/* PictureZ Blog: shared stylesheet (public + admin).
   Dark slate theme matching picturez.com. */

:root {
  --bg: #020617;          /* slate-950 */
  --bg-soft: #0f172a;     /* slate-900 */
  --card: #111c33;
  --border: #1e293b;      /* slate-800 */
  --text: #e2e8f0;        /* slate-200 */
  --dim: #94a3b8;         /* slate-400 */
  --accent: #6366f1;      /* indigo-500 */
  --accent-2: #38bdf8;    /* sky-400 */
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* No body font-family/color/background here on purpose: the shared
   header.php/footer.php (loaded on every blog page too) already set those
   via Tailwind classes on <body>. Declaring them again here, even though
   blog.css loads after app-B6AHulV8.css, would win the cascade for any
   element that doesn't carry its own font/color utility class, which is
   exactly the shared <nav>/<footer>'s brand text and links. That's what
   was making the header look different on blog pages. */
body {
  margin: 0;
  line-height: 1.65;
}

/* Scoped to blog content (and the admin panel, which also uses .wrap) so
   the shared nav/footer keep their own Tailwind link styling untouched. */
.wrap a { color: var(--accent-2); text-decoration: none; }
.wrap a:hover { text-decoration: underline; }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
/* Wider container for the 3-up post grid on the index page; single posts
   stay on the narrower .wrap above for comfortable reading width. */
.wrap-wide { max-width: 1180px; }

/* ---------- shared UI bits used in blog content + admin ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  border: 1px solid var(--accent);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #4f46e5; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text) !important; border-color: var(--border); }
.btn.ghost:hover { border-color: var(--dim); }

/* ---------- index ---------- */
.page-head { padding: 3.5rem 0 1.5rem; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-2);
  margin: 0 0 0.6rem;
}
.page-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.25; margin: 0 0 0.7rem; }
.lede { color: var(--dim); margin: 0; font-size: 1.05rem; }

.post-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  margin-top: 1.5rem;
}
@media (max-width: 940px) {
  .post-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .post-list { grid-template-columns: 1fr; }
}
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.post-card-image {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b1120;
}
.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.post-card-image:hover img { transform: scale(1.05); }
.post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.3rem 1.4rem 1.5rem;
}
.post-card h2 { margin: 0 0 0.35rem; font-size: 1.15rem; line-height: 1.35; }
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--accent-2); }
.post-meta { color: var(--dim); font-size: 0.88rem; margin: 0 0 0.6rem; }
.post-meta .kw {
  color: var(--accent-2);
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}
.post-excerpt { color: var(--dim); margin: 0 0 0.7rem; }
.read-more { font-weight: 600; font-size: 0.95rem; margin-top: auto; }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--dim);
}
.page-num { font-size: 0.9rem; }
.dim { color: var(--dim); }

.empty-state {
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin-top: 1.5rem;
}

/* ---------- post page ---------- */
.post-main { padding-top: 2rem; }
.post h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); line-height: 1.2; margin: 0.2rem 0 0.6rem; }
.post .post-meta { margin-bottom: 1.4rem; }
.post-image { margin: 1.4rem 0; }
.post-image img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }

.post-body { font-size: 1.06rem; }
.post-body p { margin: 0 0 1.15rem; }
.post-body h2 {
  font-size: 1.45rem;
  margin: 2rem 0 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}
.post-body h3 { font-size: 1.2rem; margin: 1.6rem 0 0.6rem; }
.post-body h4 { font-size: 1.05rem; margin: 1.3rem 0 0.5rem; }
.post-body ul, .post-body ol { padding-left: 1.4rem; margin: 0 0 1.15rem; }
.post-body li { margin-bottom: 0.3rem; }
.post-body blockquote {
  margin: 1.4rem 0;
  padding: 0.6rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--dim);
}
.post-body blockquote p { margin: 0.3rem 0; }
.post-body code {
  background: #1e293b;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.post-body pre {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 0 0 1.15rem;
}
.post-body pre code { background: none; padding: 0; border-radius: 0; font-size: 0.9rem; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.post-body a { text-decoration: underline; }
.post-body img { max-width: 100%; height: auto; border-radius: var(--radius); }

.preview-banner {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--warn);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

.post-cta {
  background: linear-gradient(120deg, #1e1b4b, #0c4a6e);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem;
  margin-top: 2.5rem;
}
.post-cta h2 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.post-cta p { margin: 0 0 0.8rem; color: var(--dim); }

/* ---------- admin ---------- */
.admin { max-width: 900px; padding-top: 2rem; padding-bottom: 4rem; }
.admin h1 { margin: 0.2rem 0 0.4rem; }
.admin h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-top: 2rem; }
.admin-head { border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.admin-user { color: var(--dim); font-size: 0.95rem; }
.admin-user a { color: var(--accent-2); }

.auth-box {
  max-width: 420px;
  margin: 6vh auto 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.auth-box label { display: block; margin-bottom: 0.9rem; color: var(--dim); font-size: 0.92rem; }
.auth-box input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
}

.post-form label {
  display: block;
  margin: 1rem 0 0.35rem;
  color: var(--dim);
  font-size: 0.92rem;
}
.post-form input[type="text"],
.post-form input[type="url"],
.post-form input[type="datetime-local"],
.post-form select,
.post-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
}
.post-form textarea.body-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
.post-form .checkline { display: flex; align-items: center; gap: 0.5rem; color: var(--text); }
.post-form .checkline input { width: auto; margin: 0; }
.form-actions { margin-top: 1.4rem; display: flex; gap: 0.8rem; align-items: center; }

.post-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.94rem; }
.post-table th, .post-table td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.post-table th { color: var(--dim); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.post-table code { background: #1e293b; border-radius: 5px; padding: 0.08rem 0.35rem; font-size: 0.85em; }
.actions { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }

.status { display: inline-block; padding: 0.08rem 0.5rem; border-radius: 999px; font-size: 0.78rem; }
.status-draft { background: rgba(148, 163, 184, 0.15); color: var(--dim); }
.status-scheduled { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.status-published { background: rgba(74, 222, 128, 0.15); color: var(--ok); }

.notice, .warn, .error {
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.93rem;
  border: 1px solid var(--border);
}
.notice { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.35); color: var(--ok); }
.warn { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); color: var(--warn); }
.error { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.4); color: var(--err); }
.error-list { color: var(--err); }

.inline-form { display: inline; margin: 0; }
button.linklike {
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  font-family: inherit;
}
button.linklike.danger { color: var(--err); }
button.linklike:hover { text-decoration: underline; }

.admin-tip { margin-top: 2.5rem; font-size: 0.9rem; }

@media (max-width: 560px) {
  .blog-header .wrap { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .post-table th:nth-child(2), .post-table td:nth-child(2) { display: none; }
}