:root {
  --black: #1a1a1a;
  --muted: #858585;
  --border: #e3e3e3;
  --soft: #f7f7f7;
  --bg: #fff;
  --accent: #2155a4;
}

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

html { font-size: 18px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--black);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.7;
}

a { color: inherit; }

.page-frame {
  width: min(calc(100% - 4rem), 1040px);
  margin: 0 auto;
  padding: 3.6rem 0 6rem;
  display: grid;
  grid-template-columns: 112px minmax(0, 870px);
  gap: 2.8rem;
  align-items: start;
}

.side-tabs {
  position: sticky;
  top: 3.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.side-tab {
  padding: 0.35rem 0 0.35rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.4;
  text-decoration: none;
}

.side-tab:hover { color: var(--accent); }

.side-tab[aria-current="page"] {
  border-left-color: var(--accent);
  color: var(--black);
  font-weight: 500;
}

.shell { min-width: 0; }

.page-header { padding: 0 0 2.4rem; }

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.write-action {
  flex-shrink: 0;
  margin-top: 0.2rem;
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
}
.write-action:hover { border-color: var(--accent); color: var(--accent); }

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.35; }

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.page-description {
  max-width: 600px;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 15px;
}

.post-list { border-top: 1px solid var(--border); }

.post-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 1.4rem;
  padding: 1.65rem 0;
  border-bottom: 1px solid var(--border);
}

.post-date,
.post-meta {
  color: var(--muted);
  font-size: 13px;
}

.post-card h2 {
  margin: 0 0 0.35rem;
  font-size: 18px;
  font-weight: 500;
}

.post-card h2 a { text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }

.post-summary {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.tag {
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 15px;
}

.text-link { color: var(--accent); text-underline-offset: 3px; }

.article-header {
  max-width: 720px;
  padding: 0 0 2rem;
}

.article-title { margin-top: 0.45rem; }

.article-body {
  max-width: 720px;
  padding: 1.8rem 0 4rem;
  border-top: 1px solid var(--border);
  font-size: 16px;
}

.article-body h2 { margin: 2.4rem 0 0.7rem; font-size: 23px; font-weight: 500; }
.article-body h3 { margin: 2rem 0 0.6rem; font-size: 19px; font-weight: 500; }
.article-body p { margin: 0 0 1.25rem; }
.article-body a { color: var(--accent); text-underline-offset: 3px; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; }
.article-figure { margin: 0 0 2.2rem; }
.article-figure img { display: block; width: 100%; }
.article-figure figcaption {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.article-body blockquote {
  margin: 1.5rem 0;
  padding: 0.15rem 0 0.15rem 1.1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.article-body pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 5px;
  background: var(--soft);
  font-size: 13px;
  line-height: 1.6;
}
.article-body code {
  padding: 0.1em 0.28em;
  border-radius: 3px;
  background: var(--soft);
  font-size: 0.88em;
}
.article-body pre code { padding: 0; background: transparent; }
.article-body ul, .article-body ol { margin: 0 0 1.25rem; padding-left: 1.4rem; }

.back-link {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }

.editor-intro { padding-bottom: 1.8rem; }
.editor-intro .eyebrow { margin-top: 1rem; }

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.editor-panel {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.panel-title {
  margin: 0 0 1rem;
  font-size: 14px;
  font-weight: 500;
}

.field { display: block; margin-bottom: 0.9rem; }

.field-label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 12px;
}

input, textarea, button { font: inherit; }

input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--black);
  outline: none;
}

input { height: 42px; padding: 0 0.7rem; font-size: 14px; }
textarea { min-height: 290px; padding: 0.7rem; resize: vertical; font-size: 14px; line-height: 1.65; }
input:focus, textarea:focus { border-color: var(--accent); }

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.button {
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--black);
  border-radius: 4px;
  background: var(--black);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.button:hover { background: var(--accent); border-color: var(--accent); }
.button.secondary { background: var(--bg); color: var(--black); border-color: var(--border); }
.button.secondary:hover { color: var(--accent); border-color: var(--accent); }

.status {
  min-height: 1.5rem;
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 12px;
}
.status.error { color: #a33a3a; }

.preview {
  min-height: 420px;
  font-size: 14px;
}
.preview .placeholder { color: var(--muted); }
.preview h1 { font-size: 24px; }
.preview h2 { margin-top: 1.5rem; font-size: 19px; font-weight: 500; }
.preview h3 { margin-top: 1.3rem; font-size: 16px; font-weight: 500; }
.preview p { margin: 0 0 0.9rem; }
.preview a { color: var(--accent); }
.preview pre { overflow-x: auto; padding: 0.7rem; background: var(--soft); font-size: 12px; }
.preview blockquote { margin-left: 0; padding-left: 0.8rem; border-left: 2px solid var(--accent); color: var(--muted); }

.publish-note {
  margin-top: 1.4rem;
  padding: 1rem 1.1rem;
  border-radius: 5px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12.5px;
}
.publish-note strong { color: var(--black); font-weight: 500; }

@media (max-width: 760px) {
  .editor-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  html { font-size: 16px; }
  .page-frame {
    width: min(calc(100% - 2.5rem), 870px);
    padding: 2.3rem 0 4rem;
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .side-tabs {
    position: static;
    flex-direction: row;
    gap: 1.3rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
  }
  .side-tab { padding: 0 0 0.45rem; border-left: 0; border-bottom: 2px solid transparent; }
  .side-tab[aria-current="page"] { border-left-color: transparent; border-bottom-color: var(--accent); }
  .page-header { padding-bottom: 1.8rem; }
  .post-card { grid-template-columns: 1fr; gap: 0.35rem; }
  .article-body { font-size: 15px; }
}
