/* mstang.org — public pages. Also the editor's content CSS (TinyMCE adds
   class "entry-content" to its body), so posts look the same while writing. */

:root {
  --bg: #ffffff;
  --surface: #f6f5f1;
  --fg: #222321;
  --muted: #6c6c66;
  --line: #e5e2db;
  --accent: #2c6a58;
  --accent-hover: #1d4b3e;
  --notice-bg: #fff6dc;
  --notice-line: #d9a300;
  --banner-shade: rgba(0, 0, 0, 0.5);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151715;
    --surface: #1d201d;
    --fg: #e7e5df;
    --muted: #a19e96;
    --line: #2e322e;
    --accent: #84c6ae;
    --accent-hover: #a9dcc8;
    --notice-bg: #3a3218;
    --notice-line: #c99a12;
    --banner-shade: rgba(0, 0, 0, 0.62);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ── header ─────────────────────────────────────────── */

.banner {
  display: flex;
  align-items: flex-end;
  min-height: clamp(170px, 26vw, 320px);
  padding: 0 0 28px;
  background:
    linear-gradient(to top, var(--banner-shade), rgba(0, 0, 0, 0.04) 70%),
    url("/static/header.jpg") center 62% / cover no-repeat #3b3f3a;
}
.banner .wrap { width: 100%; }
.site-title {
  color: #fff;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}
.site-title:hover { color: #fff; text-decoration: none; }
.tagline { margin: 2px 0 0; color: rgba(255, 255, 255, 0.88); font-size: 0.95rem; letter-spacing: 0.02em; }

.site-nav { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-nav .wrap { display: flex; flex-wrap: wrap; gap: 4px 24px; padding-top: 12px; padding-bottom: 12px; }
.site-nav a { color: var(--fg); font-size: 0.95rem; }
.site-nav a:hover { color: var(--accent); }
.site-nav .admin-link { margin-left: auto; color: var(--accent); }

/* ── layout ─────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 64px;
  padding-top: 48px;
  padding-bottom: 64px;
}
.content { min-width: 0; max-width: 700px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 48px; padding-top: 32px; }
  .content { max-width: none; }
}

/* ── posts ──────────────────────────────────────────── */

.archive-title { margin: 0 0 32px; font-size: 1.15rem; font-weight: 600; color: var(--muted); }

.post { margin: 0 0 56px; padding: 0 0 48px; border-bottom: 1px solid var(--line); }
.post.brief { margin-bottom: 28px; padding-bottom: 24px; }
.post.single { border-bottom: 0; padding-bottom: 8px; }

.meta { margin: 0 0 6px; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.02em; }
.meta a { color: var(--muted); }
.entry-title { margin: 0 0 20px; font-size: 1.55rem; line-height: 1.45; font-weight: 700; }
.single .entry-title { font-size: 1.9rem; }
.entry-title a { color: var(--fg); }
.entry-title a:hover { color: var(--accent); text-decoration: none; }
.brief .entry-title { margin-bottom: 8px; font-size: 1.25rem; }
.excerpt { margin: 0; color: var(--muted); }

.notice {
  margin: 0 0 16px;
  padding: 8px 12px;
  background: var(--notice-bg);
  border-left: 3px solid var(--notice-line);
  font-size: 0.9rem;
}
.edit { margin: 16px 0 0; font-size: 0.9rem; }
.tags { margin: 28px 0 0; color: var(--muted); font-size: 0.9rem; }
.tags a { display: inline-block; margin: 0 8px 4px 0; padding: 1px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.tags a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.children { margin: 32px 0 0; padding: 16px 20px; background: var(--surface); border-radius: 8px; }
.children h2 { margin: 0 0 6px; font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.children ul { margin: 0; padding-left: 1.2em; }

/* ── post body (also the editor) ────────────────────── */

.entry-content { font-size: 1.0625rem; line-height: 1.9; overflow-wrap: anywhere; }
.entry-content > :first-child { margin-top: 0; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content h2 { margin: 1.8em 0 0.6em; font-size: 1.35rem; line-height: 1.5; }
.entry-content h3 { margin: 1.6em 0 0.5em; font-size: 1.15rem; line-height: 1.5; }
.entry-content h4 { margin: 1.4em 0 0.5em; font-size: 1rem; }
.entry-content ul, .entry-content ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.entry-content li { margin: 0.25em 0; }
.entry-content blockquote {
  margin: 1.4em 0;
  padding: 0.2em 0 0.2em 1.1em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.entry-content img, .entry-content video { max-width: 100%; height: auto; border-radius: 4px; }
.entry-content figure { margin: 1.4em 0; }
.entry-content figcaption, .entry-content .wp-caption-text { color: var(--muted); font-size: 0.85rem; text-align: center; }
.entry-content table { width: 100%; margin: 0 0 1.2em; border-collapse: collapse; font-size: 0.95rem; }
.entry-content th, .entry-content td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; }
.entry-content pre, .entry-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
.entry-content code { padding: 0.1em 0.35em; background: var(--surface); border-radius: 4px; }
.entry-content pre { padding: 14px 16px; overflow-x: auto; background: var(--surface); border-radius: 6px; line-height: 1.6; }
.entry-content pre code { padding: 0; background: none; }
.entry-content hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
/* WordPress alignment classes in imported posts. */
.entry-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.entry-content .alignleft { float: left; margin: 0.3em 1.4em 0.8em 0; }
.entry-content .alignright { float: right; margin: 0.3em 0 0.8em 1.4em; }
.entry-content::after { content: ""; display: table; clear: both; }

/* The editor's own page body. */
body.entry-content { max-width: 760px; margin: 16px auto; padding: 0 16px; }

/* ── comments & navigation ──────────────────────────── */

.comments { margin: 8px 0 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.comments h2 { margin: 0 0 16px; font-size: 1.05rem; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-meta { margin: 0 0 4px; color: var(--muted); font-size: 0.85rem; }
.comment-body p { margin: 0 0 0.6em; }
.comments .closed { margin: 14px 0 0; color: var(--muted); font-size: 0.85rem; }

.pager, .post-nav { display: flex; justify-content: space-between; gap: 24px; }
.pager .older, .post-nav .newer { margin-left: auto; text-align: right; }
.post-nav { padding-top: 24px; border-top: 1px solid var(--line); }
.post-nav a { display: block; max-width: 48%; color: var(--fg); }
.post-nav a:hover { color: var(--accent); text-decoration: none; }
.post-nav span { display: block; color: var(--muted); font-size: 0.8rem; }

.empty { color: var(--muted); }

/* ── sidebar ────────────────────────────────────────── */

.sidebar { font-size: 0.95rem; }
.search { display: flex; gap: 6px; margin: 0 0 36px; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.search button {
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  cursor: pointer;
}
.widget { margin: 0 0 36px; }
.widget h2 { margin: 0 0 8px; color: var(--muted); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; }
.widget ul { margin: 0; padding: 0; list-style: none; }
.widget li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.widget li:last-child { border-bottom: 1px solid var(--line); }
.widget a { color: var(--fg); }
.widget a:hover { color: var(--accent); }
.count { color: var(--muted); font-size: 0.85rem; }

/* ── footer ─────────────────────────────────────────── */

.site-footer { padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
