/* NXBlogger – calm light blue theme */
:root {
  --bg: #eef5fb;
  --bg-2: #e3eef8;
  --surface: #ffffff;
  --border: #d4e3f0;
  --text: #22364a;
  --muted: #6a7f94;
  --primary: #3f86c6;
  --primary-dark: #2f6fa9;
  --primary-soft: #dcebf8;
  --primary-softer: #eef6fd;
  --success: #3c9a73;
  --success-soft: #e2f4ec;
  --danger: #c4555a;
  --danger-soft: #fbe9ea;
  --warn-soft: #fdf5e1;
  --radius: 16px;
  --radius-sm: 10px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(34, 54, 74, .04), 0 6px 20px rgba(63, 134, 198, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-2) 0, var(--bg) 320px) no-repeat, var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .6em; color: #1c3044; font-weight: 650; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
img { max-width: 100%; height: auto; }
code, pre, kbd { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }

.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 20px; }
main.wrap { flex: 1; padding-top: 8px; padding-bottom: 40px; }
.page-wide .wrap { max-width: 1240px; }
.page-mid .wrap { max-width: 1100px; }
main.narrow { max-width: 440px; }

/* Header ------------------------------------------------------------------- */
.site-header { padding: 26px 0 18px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.brand img { border-radius: 12px; box-shadow: var(--shadow); }
.brand-title { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: .01em; color: #1c3044; }
.brand-sub { display: block; font-size: .92rem; color: var(--muted); }
.mainnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mainnav > a {
  padding: 7px 15px; border-radius: var(--pill); text-decoration: none; color: var(--text); font-size: .95rem;
}
.mainnav > a:hover { background: var(--surface); color: var(--primary-dark); }
.search { margin: 0 0 0 6px; }
.mainnav .search input[type=search] {
  width: 180px; margin: 0; padding: 7px 16px; border-radius: var(--pill); border: 1px solid var(--border);
  background: var(--surface); font-size: .92rem;
}

/* Admin bar ------------------------------------------------------------------ */
.adminbar { background: var(--primary); color: #fff; font-size: .9rem; }
.adminbar-inner { display: flex; gap: 6px; align-items: center; padding-top: 6px; padding-bottom: 6px; flex-wrap: wrap; max-width: 1240px; }
.adminbar-label { font-weight: 600; margin-right: 10px; opacity: .9; }
.adminbar a, .adminbar .linkbtn {
  color: #fff; text-decoration: none; padding: 3px 12px; border-radius: var(--pill);
  background: transparent; border: 0; font: inherit; cursor: pointer;
}
.adminbar a:hover, .adminbar .linkbtn:hover { background: rgba(255, 255, 255, .18); }
.adminbar form { margin-left: auto; }

/* Cards ---------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 32px; margin-bottom: 22px;
}
.card.empty { text-align: center; padding: 48px 24px; }

/* Buttons --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 22px; border-radius: var(--pill); border: 1px solid var(--primary);
  background: var(--primary); color: #fff; font: inherit; font-size: .95rem; font-weight: 550;
  text-decoration: none; cursor: pointer; transition: background .15s, box-shadow .15s, transform .05s;
  line-height: 1.3;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(63, 134, 198, .35); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-soft { background: var(--primary-softer); color: var(--primary-dark); border-color: var(--border); }
.btn-soft:hover { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #f1cfd1; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 14px; font-size: .85rem; }
.btn-block { display: flex; width: 100%; }

/* Flash messages --------------------------------------------------------------- */
.flashes { margin-bottom: 16px; }
.flash { padding: 11px 18px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: .95rem; border: 1px solid transparent; }
.flash-success { background: var(--success-soft); color: #23664a; border-color: #c7e8d9; }
.flash-error { background: var(--danger-soft); color: #93363b; border-color: #f1cfd1; }
.flash-info { background: var(--primary-softer); color: var(--primary-dark); border-color: var(--border); }

/* Post list ------------------------------------------------------------------- */
.listing-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 4px 14px; }
.listing-head h1 { font-size: 1.35rem; margin: 0; }
.post-card { display: flex; gap: 24px; padding: 22px; align-items: flex-start; }
.post-card-img { flex: 0 0 200px; display: block; border-radius: 12px; overflow: hidden; background: var(--primary-softer); aspect-ratio: 4 / 3; }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.post-card-img:hover img { transform: scale(1.03); }
.post-card-body { flex: 1; min-width: 0; }
.post-card h2 { margin: 2px 0 8px; font-size: 1.3rem; }
.post-card h2 a { color: inherit; text-decoration: none; }
.post-card h2 a:hover { color: var(--primary-dark); }
.excerpt { color: #4a5f74; margin: 0 0 14px; }
.date { color: var(--muted); font-size: .85rem; letter-spacing: .02em; }

.pagination, .post-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0 24px; }
.post-nav .btn { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

/* Single post ----------------------------------------------------------------- */
.post { padding: 36px 44px; }
.post-head { margin-bottom: 22px; }
.post-head h1 { font-size: 2rem; margin: 4px 0 10px; }
.post-admin { margin-top: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 2px 12px; border-radius: var(--pill); background: var(--primary-softer);
  border: 1px solid var(--border); color: var(--primary-dark); font-size: .82rem; text-decoration: none;
}
.tag:hover { background: var(--primary-soft); }
.tag small { color: var(--muted); margin-left: 3px; }
.tag-lg { font-size: 1rem; vertical-align: middle; }
.tag-cloud { margin-bottom: 20px; }

.post-content { overflow-wrap: break-word; }
.post-content > :first-child { margin-top: 0; }
.post-content p { margin: 0 0 1.1em; }
.post-content h2 { margin-top: 1.6em; }
.post-content h3 { margin-top: 1.4em; font-size: 1.15rem; }
.post-content img { border-radius: 10px; cursor: zoom-in; }
.post-content blockquote {
  margin: 1.2em 0; padding: 10px 20px; border-left: 4px solid var(--primary-soft);
  background: var(--primary-softer); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: #3d5469;
}
.post-content pre {
  background: #f4f8fc; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; overflow-x: auto; line-height: 1.5;
}
.post-content code { background: #f0f6fc; padding: 1px 5px; border-radius: 5px; }
.post-content pre code { background: none; padding: 0; }
.post-content table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95rem; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.post-content th { background: var(--primary-softer); }
.post-content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.post-content figure { margin: 1.2em 0; }
.post-content figcaption { color: var(--muted); font-size: .88rem; text-align: center; margin-top: 6px; }
.post-content .aligncenter, .post-content figure.aligncenter { display: block; margin-left: auto; margin-right: auto; text-align: center; }
.post-content .alignleft { float: left; margin: .3em 1.2em .8em 0; max-width: 50%; }
.post-content .alignright { float: right; margin: .3em 0 .8em 1.2em; max-width: 50%; }
.post-content::after { content: ""; display: table; clear: both; }
.post-content .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 1em 0; }
.post-content .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; }
/* Galleries and images imported from the WordPress block editor */
.post-content .wp-block-image { margin: 1.4em 0; text-align: center; }
/* Keep tall portrait photos within the screen */
.post-content figure img, .post-content p > img { max-height: 80vh; width: auto; }
.post-content .wp-block-gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 1.4em 0;
}
.post-content .wp-block-gallery figure { margin: 0; }
.post-content .wp-block-gallery.is-cropped img { width: 100%; height: 100%; max-height: 60vh; object-fit: cover; }
.post-content .wp-block-gallery > figure:only-child { text-align: center; }
.post-content .wp-block-gallery > figure:only-child img { width: auto; height: auto; max-height: 80vh; }
.post-content .video-embed, .post-content iframe { max-width: 100%; }
.post-content .video-embed { position: relative; aspect-ratio: 16 / 9; margin: 1em 0; }
.post-content .video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 10px; }
.post-content video { max-width: 100%; border-radius: 10px; }

.lightbox {
  position: fixed; inset: 0; background: rgba(20, 36, 52, .82); display: flex; align-items: center;
  justify-content: center; padding: 24px; cursor: zoom-out; z-index: 100;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }

/* Archive -------------------------------------------------------------------- */
.archive-year { margin-top: 1.4em; color: var(--primary-dark); font-size: 1.2rem; }
.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-list li { padding: 6px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 16px; }
.archive-list .date { flex: 0 0 90px; padding-top: 2px; }

/* Forms ---------------------------------------------------------------------- */
.form label, .editor-side label { display: block; margin-bottom: 16px; font-size: .92rem; font-weight: 550; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=datetime-local],
input[type=file], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 14px; font: inherit; font-size: .95rem;
  font-weight: 400; color: var(--text); background: #fbfdff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(63, 134, 198, .15);
}
.checks { margin: 4px 0 18px; }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 400 !important; margin-bottom: 8px !important; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.hint { font-size: .85rem; margin-top: 12px; }
.login-card { margin-top: 30px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-2 .card { margin-bottom: 0; }
.report { padding-left: 20px; }

/* Dashboard ------------------------------------------------------------------- */
.toolbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.toolbar-row h1 { margin: 0; }
.filter-row { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-row input, .filter-row select { margin: 0; width: auto; flex: 1 1 200px; }
.filter-row select { flex: 0 1 200px; }
.table-wrap { overflow-x: auto; }
.posts-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.posts-table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.posts-table td { padding: 10px; border-bottom: 1px solid #edf3f9; vertical-align: middle; }
.posts-table tr:hover td { background: #f8fbfe; }
.post-title-link { font-weight: 550; text-decoration: none; color: var(--text); }
.actions { white-space: nowrap; text-align: right; }
.actions-col { text-align: right !important; }
.actions .btn, .actions form { margin-left: 4px; }
.badge { display: inline-block; padding: 2px 11px; border-radius: var(--pill); font-size: .8rem; font-weight: 550; }
.badge-published { background: var(--success-soft); color: #23664a; }
.badge-draft { background: var(--warn-soft); color: #8a6414; }

/* Editor ---------------------------------------------------------------------- */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.editor-main { padding: 24px; margin: 0; }
.editor-side { position: sticky; top: 16px; margin: 0; padding: 22px; }
.editor-side h2 { font-size: 1.1rem; }
.editor-side details { margin-bottom: 16px; }
.editor-side summary { cursor: pointer; color: var(--primary-dark); font-size: .92rem; margin-bottom: 12px; }
.side-buttons { display: grid; gap: 8px; }
.title-input {
  font-size: 1.6rem !important; font-weight: 650 !important; border: 0 !important; background: transparent !important;
  padding: 4px 2px 10px !important; margin: 0 0 8px !important; box-shadow: none !important; border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
}
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px; margin-bottom: 12px;
  background: var(--primary-softer); border: 1px solid var(--border); border-radius: var(--radius-sm);
  position: sticky; top: 8px; z-index: 5;
}
.editor-toolbar button {
  border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; font-size: .88rem;
  padding: 4px 11px; border-radius: var(--pill); cursor: pointer; min-width: 34px;
}
.editor-toolbar button:hover { background: var(--surface); border-color: var(--border); }
.editor-toolbar button.active { background: var(--primary); color: #fff; }
.editor-toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor {
  min-height: 460px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; outline: none;
}
.editor:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(63, 134, 198, .12); }
.editor:empty::before { content: attr(data-placeholder); color: #9aabbc; }
.editor.dragover { background: var(--primary-softer); border-style: dashed; border-color: var(--primary); }
.editor img { cursor: default; }
.editor img.uploading { opacity: .45; outline: 2px dashed var(--primary); }
.editor img.selected { outline: 3px solid var(--primary); }
.source-editor { min-height: 460px; font-family: var(--mono) !important; font-size: .85rem !important; line-height: 1.5; }
.editor-status { min-height: 1.4em; font-size: .85rem; color: var(--muted); margin-top: 8px; }
.delete-form { margin-top: 18px; }

/* Footer ---------------------------------------------------------------------- */
.site-footer { padding: 22px 0 30px; color: var(--muted); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); padding-top: 18px; }
.footer-links a { color: var(--muted); margin-left: 14px; text-decoration: none; }
.footer-links a:hover { color: var(--primary-dark); }

/* Responsive ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .card { padding: 20px; }
  .post { padding: 24px 20px; }
  .post-head h1 { font-size: 1.6rem; }
  .post-card { flex-direction: column; padding: 16px; }
  .post-card-img { flex: none; width: 100%; aspect-ratio: 16 / 9; }
  .mainnav .search input[type=search] { width: 140px; }
  .actions { white-space: normal; }
  .post-content .alignleft, .post-content .alignright { float: none; margin: 1em auto; max-width: 100%; }
}
