:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --line: #dde3eb;
  --line-soft: #eef2f7;
  --text: #0b1018;
  --muted: #657084;
  --soft: #394459;
  --accent: #0f1724;
  --blue: #3867e8;
  --green: #238348;
  --purple: #7357f6;
  --yellow: #c78300;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --max: 1220px;
  --article: 780px;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background-color: #f8fafc;
  color: #0b1018;
}
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  background:
    radial-gradient(circle at 72% 8%, rgba(115, 87, 246, 0.12), transparent 30rem),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 46%, #f7f9fc 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
.page { width: min(100% - 56px, var(--max)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 14px;
  z-index: 10;
  width: min(100% - 56px, var(--max));
  margin: 14px auto 0;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(18px);
}
.site-header .page { width: 100%; }
.nav {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 32px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  text-decoration: none;
}
.brand-name { font-size: 22px; font-weight: 820; }
.brand-subtitle { font-size: 20px; font-weight: 500; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
  color: #111827;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.nav-links a:hover, .text-link:hover { color: var(--blue); }
.theme-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
}
.auth-button, .button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #101827;
  cursor: pointer;
  font-size: 14px;
  font-weight: 720;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.auth-button { display: inline-flex; }
.button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08); }
.button.primary { border-color: #0a0f18; background: #0a0f18; color: #fff; }
.button.ghost { background: #fff; color: #0f172a; }
.button.danger { border-color: #f0b7b7; color: #b42323; }
.button:disabled { cursor: not-allowed; opacity: 0.62; }
.auth-status {
  display: inline-flex;
  max-width: 190px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--soft);
  font-size: 13px;
}
.auth-status[hidden] { display: none; }
.auth-avatar {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #e8edff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 760;
}
.auth-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-role { color: var(--green); font-size: 11px; font-weight: 760; }

main.page {
  min-height: 70vh;
  margin-top: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}
main.page:focus { outline: none; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(360px, 1.02fr);
  gap: 46px;
  align-items: center;
  min-height: 470px;
  padding: 70px 72px 68px;
  border-bottom: 1px solid var(--line);
}
.hero-copy { max-width: 520px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f3f6fa;
  color: #111827;
  font-size: 13px;
  font-weight: 650;
}
.eyebrow span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #28b94c;
}
h1 {
  max-width: 620px;
  margin-bottom: 18px;
  color: #090e17;
  font-size: clamp(42px, 5.8vw, 66px);
  line-height: 1.02;
  font-weight: 820;
}
.subtitle, .description, .listing-hero p, .admin-hero p, .access-gate p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero-visual {
  position: relative;
  min-height: 320px;
}
.viz-card {
  position: absolute;
  display: grid;
  place-items: center;
  width: 190px;
  height: 112px;
  border: 1px solid #e3e8f1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #8d80ff;
  box-shadow: 0 24px 70px rgba(104, 92, 191, 0.13);
  transform: rotate(6deg);
}
.viz-card svg { width: 88%; height: 82%; }
.scatter { top: 10px; left: 80px; }
.pitch { top: 34px; right: 22px; color: #7a957f; transform: rotate(5deg); }
.code { top: 150px; left: 18px; color: #8d80ff; transform: rotate(5deg); }
.chart { right: 16px; bottom: 4px; width: 245px; height: 150px; color: #8d80ff; transform: rotate(7deg); }

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 36px;
  padding: 28px 48px 0;
}
.main-column { min-width: 0; }
.home-section { margin-bottom: 28px; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.section-heading h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}
.section-heading p { margin: 0; color: var(--muted); line-height: 1.6; }
.with-action { align-items: center; }
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.post-card, .recent-item, .side-card, .project-card, .index-card, .admin-row, .access-gate, .state-block, .editor-shell, .preview-pane {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.04);
}
.post-card, .recent-item, .project-card, .index-card {
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.post-card:hover, .recent-item:hover, .project-card:hover, .index-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
}
.post-card { overflow: hidden; }
.post-card .post-meta, .post-card h3, .post-card p, .post-card .read-more { margin-right: 18px; margin-left: 18px; }
.post-visual {
  display: block;
  width: 100%;
  object-fit: cover;
  background: #eef2f7;
}
.post-visual.has-cover {
  background-position: center;
  background-size: cover;
}
.post-visual.featured { aspect-ratio: 16 / 8.5; border-bottom: 1px solid var(--line-soft); }
.post-visual.thumb { width: 112px; height: 78px; flex: 0 0 112px; border-radius: 7px; }
div.post-visual {
  position: relative;
  overflow: hidden;
}
div.post-visual span { position: absolute; border-radius: 999px; background: currentColor; opacity: 0.42; }
div.post-visual span:nth-child(1) { width: 36%; height: 3px; left: 16%; top: 30%; }
div.post-visual span:nth-child(2) { width: 48%; height: 3px; left: 24%; top: 48%; }
div.post-visual span:nth-child(3) { width: 28%; height: 3px; left: 18%; top: 66%; }
div.post-visual span:nth-child(4) { width: 18px; height: 18px; right: 18%; top: 42%; opacity: 0.28; }
.visual-data-science { color: #7c6cff; background: linear-gradient(135deg, #111827, #263347); }
.visual-football-tactics { color: #73ad4b; background: linear-gradient(135deg, #23400e, #78a951); }
.visual-statistics-math { color: #94b9e8; background: linear-gradient(135deg, #f6f8fb, #e8edf6); }
.visual-projects { color: #87d19e; background: linear-gradient(135deg, #101827, #1d293b); }
.visual-notes { color: #c69245; background: linear-gradient(135deg, #f8f1df, #ead8b0); }
.visual-data-science.has-cover { background-color: #111827; }
.visual-football-tactics.has-cover { background-color: #23400e; }
.visual-statistics-math.has-cover { background-color: #e8edf6; }
.visual-projects.has-cover { background-color: #101827; }
.visual-notes.has-cover { background-color: #f8f1df; }
.post-meta, .article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 760;
}
.tone-data { background: #eeeaff; color: var(--purple); }
.tone-football { background: #e9f7eb; color: var(--green); }
.tone-math { background: #e7f0ff; color: var(--blue); }
.tone-build { background: #f3efff; color: #7754d9; }
.tone-essay, .tone-note { background: #fff4d7; color: var(--yellow); }
.badge.muted { background: #f1f5f9; color: var(--muted); }
.post-card h3, .recent-item h3, .index-card h3 {
  margin-bottom: 10px;
  font-size: 17px;
  line-height: 1.28;
}
.post-card p, .recent-item p, .index-card p {
  margin-bottom: 16px;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.55;
}
.read-more { display: block; margin-bottom: 18px; color: var(--muted); font-size: 13px; font-weight: 680; }
.latest-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.recent-list {
  display: grid;
  gap: 12px;
  margin: 0 48px 48px;
}
.recent-item {
  display: flex;
  gap: 16px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: none;
  padding: 14px 18px;
}
.recent-item:hover { transform: none; box-shadow: none; background: #fbfcff; }
.recent-list .recent-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.04);
}
.recent-title-row { display: grid; gap: 5px; margin-bottom: 4px; }
.recent-title-row h3 { margin: 0; font-size: 16px; }
.recent-item p { margin: 0 0 5px; }
.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.center-action {
  display: flex;
  width: fit-content;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  margin: 12px auto;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.search-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.search-bar input {
  width: min(280px, 100%);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}
.search-bar .button { min-height: 38px; padding: 0 14px; }
.filter-note { color: var(--muted); font-size: 14px; }
.sidebar { display: grid; align-content: start; gap: 20px; padding-top: 26px; }
.side-card { padding: 22px; }
.side-card h2 { margin-bottom: 18px; font-size: 18px; }
.about-person { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.avatar {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: #edf2f7;
  color: #0f172a;
  font-weight: 800;
}
.about-card p { margin-bottom: 0; color: #202938; font-size: 14px; line-height: 1.65; }
.side-list { display: grid; gap: 12px; margin-bottom: 22px; }
.side-list a {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}
.topic-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 820;
}
.side-list strong { font-size: 14px; }
.side-list em { color: var(--muted); font-size: 13px; font-style: normal; }
.text-link {
  color: #244a92;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.projects-section {
  margin: 8px 48px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.project-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  box-shadow: none;
}
.project-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  font-weight: 820;
}
.project-flowlog { background: #dcd5ff; color: #5540d9; }
.project-aperture { background: #5c941d; color: #fff; }
.project-vocabulary { background: #ffd229; color: #111827; }
.project-site { background: #0a0f18; color: #fff; }
.project-card strong { display: block; margin-bottom: 4px; font-size: 15px; }
.project-card small { display: block; color: var(--muted); line-height: 1.4; }
.project-card em { display: block; margin-top: 10px; color: #244a92; font-size: 13px; font-style: normal; font-weight: 720; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
  text-decoration: none;
}
.tag.active, .tag:hover { border-color: #cbd5e1; background: #fff; color: var(--text); }
.category-grid, .series-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.category-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.index-card { min-height: 170px; padding: 20px; }
.index-number { display: block; margin-bottom: 22px; color: var(--blue); font-size: 12px; font-weight: 760; text-transform: uppercase; }
.index-card small { color: var(--muted); }
.chapter { padding: 48px; }

.listing-hero, .admin-hero, .access-gate, .state-block {
  margin: 48px;
  padding: 28px;
}
.listing-hero h1, .admin-hero h1, .access-gate h1, .state-block h1 {
  font-size: clamp(38px, 6vw, 72px);
}
.list-tools, .actions, .row-actions, .editor-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.list-tools { margin: 0 48px 20px; }
.empty {
  padding: 22px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.62;
}
.state-block { text-align: left; }
.loader {
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-bottom: 16px;
  border: 2px solid #d7dee8;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 820ms linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

.article-shell {
  width: min(100% - 48px, var(--article));
  margin: 0 auto;
  padding-top: 72px;
}
.article-header h1 { margin-bottom: 18px; font-size: clamp(42px, 7vw, 76px); line-height: 1; }
.article-subtitle { color: var(--soft); font-size: 22px; line-height: 1.45; }
.back-link {
  display: inline-flex;
  margin-bottom: 28px;
  color: var(--soft);
  font-weight: 700;
  text-decoration: none;
}
.cover-image {
  width: 100%;
  margin: 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.markdown-body { margin-top: 42px; color: #1f2937; font-size: 18px; line-height: 1.86; }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 2em 0 0.7em; color: var(--text); line-height: 1.16; }
.markdown-body h2 { padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 30px; }
.markdown-body h3 { font-size: 24px; }
.markdown-body p, .markdown-body li { color: #253044; }
.markdown-body a { color: #244a92; }
.markdown-body blockquote { margin: 28px 0; padding: 2px 0 2px 20px; border-left: 2px solid var(--accent); color: var(--soft); }
.markdown-body pre { overflow-x: auto; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #0f172a; color: #f8fafc; }
.markdown-body code { border-radius: 5px; background: #edf2ff; color: #213c7a; font-size: 0.9em; padding: 0.12em 0.32em; }
.markdown-body pre code { padding: 0; background: transparent; color: inherit; }
.markdown-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; }
.markdown-body th, .markdown-body td { padding: 10px 12px; border: 1px solid var(--line); }
.markdown-body th { background: #f8fafc; color: var(--text); }
.markdown-body img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: min(100% - 48px, var(--article));
  margin: 56px auto 0;
}
.post-nav a { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; }
.post-nav span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.post-nav strong { color: var(--text); }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
}
textarea { resize: vertical; line-height: 1.65; }
label { display: grid; gap: 8px; color: var(--soft); font-size: 13px; font-weight: 700; }
.admin-hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.admin-table { display: grid; gap: 12px; margin: 0 48px 48px; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 18px; }
.admin-row p { margin-bottom: 8px; color: var(--muted); }
.admin-row small { color: var(--soft); }
.editor-shell { margin: 48px; padding: 24px; }
.editor-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.editor-head h1 { max-width: 720px; margin-bottom: 0; font-size: clamp(36px, 6vw, 64px); }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.wide, .markdown-input, .preview-pane, .editor-actions, .switch-row, .ai-bar { grid-column: 1 / -1; }
.switch-row { display: flex; flex-wrap: wrap; gap: 18px; }
.switch-row label { display: inline-flex; width: auto; align-items: center; gap: 8px; }
.switch-row input { width: auto; }
.preview-pane { padding: 18px; box-shadow: none; }
.ai-bar { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius); }
.ai-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-bar-actions { display: flex; gap: 8px; align-items: center; }
.ai-status { color: var(--muted); font-size: 12px; font-weight: 720; letter-spacing: 0.04em; text-transform: uppercase; }
.ai-key-row { display: flex; gap: 8px; align-items: center; }
.ai-key-row input { flex: 1; margin: 0; }

.ai-changes { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.ai-changes-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ai-changes-title { font-size: 12px; font-weight: 720; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.diff-code { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; font-family: ui-monospace, "Cascadia Code", "SF Mono", monospace; font-size: 12px; line-height: 1.65; }
.diff-line { display: flex; gap: 8px; padding: 1px 10px; white-space: pre-wrap; word-break: break-all; }
.diff-add { background: #edfbef; color: #1a5c2e; }
.diff-remove { background: #fff0f0; color: #902020; }
.diff-same { color: #5a6578; }
.diff-skip { background: #f5f7fa; color: #8a96a4; font-style: italic; padding: 3px 10px; }
.diff-sign { flex: 0 0 12px; font-weight: 760; user-select: none; }
.diff-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.diff-meta:last-of-type { margin-bottom: 8px; }
.diff-meta-label { font-weight: 720; color: var(--muted); font-size: 11px; text-transform: uppercase; flex: 0 0 auto; }
.diff-meta del { color: #902020; text-decoration: line-through; }
.diff-meta ins { color: #1a5c2e; text-decoration: none; }
.diff-none { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

.ai-chat { border-top: 1px solid var(--line-soft); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.ai-chat-messages { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.chat-msg { padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.52; max-width: 86%; }
.chat-msg-user { align-self: flex-end; background: #0a0f18; color: #f1f5f9; border-radius: 8px 8px 2px 8px; }
.chat-msg-assistant { align-self: flex-start; background: #f1f5f9; color: var(--text); border-radius: 8px 8px 8px 2px; }
.ai-chat-input-row { display: flex; gap: 8px; }
.ai-chat-input-row input { flex: 1; min-height: 40px; padding: 8px 12px; margin: 0; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.preview-head h2 { margin: 0; font-size: 18px; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  box-shadow: var(--shadow);
}
.site-footer {
  width: min(100% - 56px, var(--max));
  margin: 0 auto 28px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, 0.85);
}
.site-footer .page { width: 100%; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 48px;
  color: var(--muted);
  font-size: 13px;
}
.footer-links { display: flex; align-items: center; gap: 28px; }
.footer-links a { color: var(--soft); font-weight: 650; text-decoration: none; }

@media (max-width: 1040px) {
  .hero, .home-grid { grid-template-columns: 1fr; }
  .hero-visual { min-height: 300px; }
  .sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 0; }
  .project-grid, .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .page, .site-header, .site-footer { width: min(100% - 24px, var(--max)); }
  .site-header { position: static; }
  .nav { align-items: flex-start; flex-direction: column; padding: 18px; }
  .nav-links { width: 100%; gap: 16px; overflow-x: auto; padding-bottom: 3px; }
  .theme-button { position: absolute; top: 18px; right: 18px; }
  main.page { border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
  .hero { padding: 44px 24px; }
  .hero-visual { min-height: 250px; transform: scale(0.86); transform-origin: left top; }
  .home-grid, .projects-section { padding-right: 18px; padding-left: 18px; margin-right: 0; margin-left: 0; border-right: 0; border-left: 0; border-radius: 0; }
  .sidebar, .featured-grid, .project-grid, .category-grid, .series-grid, .editor-grid, .admin-row, .post-nav { grid-template-columns: 1fr; }
  .section-heading, .admin-hero, .editor-head, .footer-inner { align-items: flex-start; flex-direction: column; }
  .with-action { align-items: flex-start; }
  .recent-item { align-items: flex-start; }
  .post-visual.thumb { width: 86px; height: 70px; flex-basis: 86px; }
  .listing-hero, .admin-hero, .access-gate, .state-block, .editor-shell, .chapter { margin: 24px; padding: 22px; }
  .list-tools, .admin-table { margin-right: 24px; margin-left: 24px; }
  .markdown-body { font-size: 16px; line-height: 1.78; }
}
