/* blog.csherman.net — matches the csherman.net retro-doc design tokens */

:root {
  --paper: #efefeb;
  --panel: #d7d7d1;
  --ink: #171717;
  --muted: #555550;
  --line: #343434;
  --link: #075985;
  --focus: #b33b16;
  --font-mono: "Inconsolata", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
}

a:hover {
  color: var(--focus);
}

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

::selection {
  background: #fff2a8;
  color: var(--ink);
}

h1,
h2,
h3 {
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.55rem;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
}

p {
  margin: 0 0 1rem;
}

input,
button,
textarea {
  font: inherit;
  color: inherit;
}

.app {
  width: min(100%, 52rem);
  margin: 0 auto;
  padding: 1rem;
}

.site-header,
.footer {
  border: 2px dashed var(--line);
  background: var(--panel);
  padding: 1rem;
}

.site-brand {
  margin: 0;
  font-size: 2.15rem;
  font-weight: 700;
  line-height: 1.1;
}

.site-brand a {
  color: var(--ink);
  text-decoration: none;
}

.site-role {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}

.site-nav {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.76rem;
}

main > section,
main > article {
  padding: 1.5rem 1rem;
}

.footer {
  text-align: center;
  font-size: 0.78rem;
}

.footer p {
  margin: 0;
  color: var(--muted);
}

/* ------ index ------ */

.writing-group + .writing-group {
  margin-top: 1.2rem;
}

.writing-group h3 {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.writing-group ul {
  margin: 0;
  padding-left: 1.3rem;
}

.writing-group li + li {
  margin-top: 0.7rem;
}

.writing-group span {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.4;
}

.writing-empty {
  border-left: 3px solid #8a8a84;
  color: var(--muted);
  margin: 0;
  padding-left: 0.9rem;
}

/* ------ post ------ */

.post-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.8rem;
}

.post-meta {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.post-meta .tag {
  color: var(--muted);
}

.post-content {
  font-size: 1rem;
}

.post-content h2 {
  margin: 1.6rem 0 0.7rem;
  font-size: 1.3rem;
}

.post-content h3 {
  margin: 1.3rem 0 0.55rem;
}

.post-content h4 {
  margin: 1.1rem 0 0.45rem;
  font-size: 0.95rem;
}

.post-content pre {
  border: 1px dashed var(--line);
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.45;
}

.post-content code {
  font-family: var(--font-mono);
  background: var(--panel);
  padding: 0.08em 0.3em;
  font-size: 0.92em;
}

.post-content pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

.post-content blockquote {
  border-left: 3px solid #8a8a84;
  margin: 0 0 1rem;
  padding: 0.1rem 0 0.1rem 0.9rem;
  color: var(--muted);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border: 2px dashed var(--line);
  background: #fff;
  padding: 3px;
}

.post-content table {
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}

.post-content th,
.post-content td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.6rem;
  text-align: left;
}

.post-content hr {
  border: none;
  border-top: 2px dashed var(--line);
  margin: 1.5rem 0;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.post-content li + li {
  margin-top: 0.25rem;
}

.post-back {
  margin: 2rem 0 0;
  font-size: 0.9rem;
}

/* ------ buttons / forms ------ */

button,
.btn {
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.btn:hover {
  background: #fff2a8;
  color: var(--ink);
}

.danger {
  border-color: var(--focus);
  color: var(--focus);
}

input[type="text"],
input[type="password"],
.editor-fields input {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
}

.form-error {
  color: var(--focus);
}

/* ------ admin login ------ */

.login-form {
  display: grid;
  gap: 0.5rem;
  max-width: 20rem;
}

.login-form label {
  font-size: 0.85rem;
  font-weight: 600;
}

.login-form input {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 0.4rem 0.5rem;
}

/* ------ admin dashboard ------ */

.dash-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dash-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.dash-actions form {
  margin: 0;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.dash-table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  border-bottom: 1px solid #8a8a84;
  padding: 0.35rem 0.5rem;
}

.dash-table td {
  border-bottom: 1px dashed #8a8a84;
  padding: 0.45rem 0.5rem;
  vertical-align: baseline;
}

.dash-slug,
.dash-updated {
  color: var(--muted);
  font-size: 0.82rem;
}

.badge {
  border: 1px solid var(--line);
  padding: 0.05rem 0.4rem;
  font-size: 0.72rem;
}

.badge-published {
  background: #fff2a8;
}

.badge-draft {
  background: var(--panel);
  color: var(--muted);
}

/* ------ editor ------ */

.editor-body {
  height: 100vh;
  overflow: hidden;
}

.editor {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
}

.editor-top {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-bottom: 2px dashed var(--line);
  background: var(--panel);
  padding: 0.6rem 0.75rem;
}

.editor-fields {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1fr;
  gap: 0.4rem;
}

.editor-fields .f-title {
  grid-column: 1 / -1;
  font-size: 1.15rem;
  font-weight: 700;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.editor-status {
  color: var(--muted);
  margin-right: auto;
}

.editor-error {
  color: var(--focus);
  font-weight: 600;
}

.editor-panes {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
}

#content {
  border: none;
  border-right: 2px dashed var(--line);
  background: var(--paper);
  resize: none;
  padding: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
  min-height: 0;
  min-width: 0;
}

#preview {
  border: none;
  width: 100%;
  height: 100%;
  background: var(--paper);
}

@media (max-width: 56rem) {
  .editor-fields {
    grid-template-columns: 1fr;
  }

  .editor-panes {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  #content {
    border-right: none;
    border-bottom: 2px dashed var(--line);
  }
}

@media (max-width: 42rem) {
  body {
    font-size: 1rem;
  }

  .app {
    padding: 0.7rem;
  }

  .site-header,
  .footer {
    padding: 0.8rem;
  }

  main > section,
  main > article {
    padding: 1.35rem 0.8rem;
  }
}
