/* melis.im — light terminal design.
   Palette (spec): paper #FAFAF7 · ink #24292F · terminal green #1A7F37 · link blue #0550AE
   Flat rules: no gradients, no shadows on content; the boot band window may
   keep a hairline border. Two type jobs: mono for terminal-flavor, sans for
   reading comfort. */

:root {
  --paper: #FAFAF7;
  --ink: #24292F;
  --muted: #57606A;
  --faint: #8B9299;
  --accent: #1A7F37;
  --link: #0550AE;
  --border: #E4E4DA;
  --border-strong: #D6D6CC;
  --card: #FFFFFF;
  --code-bg: #F1F1EA;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

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

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

.mono { font-family: var(--mono); }
.muted { color: var(--faint); }
.prompt { color: var(--accent); font-weight: 600; }
.cursor {
  display: inline-block;
  width: .62em;
  height: 1.05em;
  background: var(--ink);
  vertical-align: text-bottom;
  margin-left: .15em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--link); }
a:visited { color: var(--link); }

/* ---------------- chrome: header + footer ---------------- */
.site-head { border-bottom: 1px solid var(--border); background: var(--paper); }
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--mono);
}
.brand-user { color: var(--ink); }
.brand-host { color: var(--accent); }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 14px;
}
.nav-links a:hover { color: var(--ink); background: #F0F0E9; }
.nav-links a.active { color: var(--ink); background: #ECECE2; }

.site-foot {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 18px 0 26px;
  color: var(--faint);
}
.foot-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
}
.foot-links a { color: var(--faint); text-decoration: none; }
.foot-links a:hover { color: var(--link); }

/* ---------------- sections + generic ---------------- */
main.wrap { padding-top: 34px; }
.section { margin-bottom: 44px; }
.sec-label {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  margin: 0 0 12px;
}
.page-head { margin-bottom: 6px; }
.page-head h1 { font-family: var(--mono); font-size: 22px; margin: 0; }
.page-sub { margin: 4px 0 14px; font-size: 14px; }
.empty { color: var(--muted); font-size: 14px; }

/* ---------------- terminal boot band ---------------- */
.boot-band { margin-bottom: 44px; }
.term-window {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
  max-width: 640px;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: #FAFAF6;
}
.term-dot { width: 10px; height: 10px; border-radius: 50%; background: #E2E2D8; }
.term-dot:first-child { background: #D9D9CE; }
.term-title { margin-left: 6px; color: var(--faint); font-size: 12px; }
.term-body { padding: 14px 16px; font-size: 14.5px; }
.term-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.term-line.out { color: var(--muted); }
.nf-window { max-width: 560px; margin: 30px 0; }

/* ---------------- cards (featured) ---------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  padding: 14px 16px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.card-title {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.card-title:hover, a.card-title:hover { color: var(--link); }
.year { color: var(--faint); font-size: 13px; }
.card-desc {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 14px;
}
.card-meta { font-size: 12.5px; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.tag {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  color: var(--accent);
  font-size: 12px;
  background: #F6F6F1;
}
.view-all { margin: 14px 2px 0; }

/* ---------------- text rows (projects, blog) ---------------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  flex-wrap: wrap;
}
.row:first-child { border-top: 1px solid var(--border); }
a.row:hover { background: #F4F4EE; border-radius: 8px; }
.proj-row { align-items: flex-start; }
.row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.proj-name { font-weight: 700; color: var(--link); text-decoration: none; }
.proj-name:hover { text-decoration: underline; }
.row-desc { color: var(--muted); font-size: 14px; }
.row-title { color: var(--link); font-weight: 500; }
.post-row .muted { font-size: 13px; }
.row-meta { display: flex; align-items: center; gap: 8px; }

/* ---------------- blog post + about reading areas ---------------- */
.post { max-width: 720px; }
.post-title { font-family: var(--sans); font-size: 30px; letter-spacing: -.01em; margin: 0 0 6px; }
.post-meta { font-size: 13.5px; margin-bottom: 26px; }
.post-body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}
.post-body h1, .post-body h2, .post-body h3 {
  font-family: var(--mono);
  letter-spacing: 0;
  margin: 30px 0 10px;
  line-height: 1.3;
}
.post-body h1 { font-size: 24px; }
.post-body h2 { font-size: 20px; }
.post-body h3 { font-size: 17px; }
.post-body p { margin: 0 0 16px; }
.post-body ul, .post-body ol { margin: 0 0 16px; padding-left: 26px; }
.post-body li { margin-bottom: 6px; }
.post-body blockquote {
  margin: 16px 0;
  padding: 6px 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: #F4F4EF;
  border-radius: 0 8px 8px 0;
}
.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
}
.post-body code { font-family: var(--mono); }
.post-body p code, .post-body li code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 13.5px;
}
.post-body img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.post-body a { color: var(--link); }
.back-link { margin-top: 30px; font-family: var(--mono); }
.contact-line { font-size: 14.5px; }

/* ---------------- admin shell ---------------- */
.admin-wrap { max-width: 560px; padding-top: 60px; text-align: left; }
.login-window { width: 100%; }
.term-input {
  font-family: var(--mono);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 10px;
  margin-left: 8px;
  min-width: 0;
  flex: 1;
}
.term-line label { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.admin-btn {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  margin-top: 12px;
}
.admin-btn:hover { background: #000; }
.login-error { color: #CF222E; padding-top: 6px; }
.admin-back { margin-top: 16px; font-size: 13.5px; }
.admin-flag { color: var(--faint); font-weight: 400; }
.logout-form { display: inline; }
.logout-form .admin-btn {
  margin-top: 0;
  background: var(--paper);
  color: var(--muted);
  border-color: var(--border-strong);
}
.logout-form .admin-btn:hover { color: #CF222E; border-color: #CF222E; background: var(--paper); }
.nav-links.admin-bar { align-items: center; }

/* ---------------- admin: posts, editor, preview ---------------- */
.admin-row { align-items: flex-start; }
.row-actions { display: flex; align-items: center; gap: 10px; }
.admin-link { font-size: 13px; }
.inline-form { display: inline; }
.status-live { color: var(--accent); font-size: 12.5px; font-weight: 600; }
.status-draft { color: var(--faint); font-size: 12.5px; }
.danger-btn {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #CF222E;
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
}
.danger-btn:hover { border-color: #CF222E; }
.primary-btn { background: var(--accent); border-color: var(--accent); }
.primary-btn:hover { background: #166B2F; border-color: #166B2F; }
.back-link-inline { font-size: 13px; margin-left: 6px; }
.editor-form { max-width: 1040px; }
.editor-fields {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.editor-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.editor-fields input {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 7px 10px;
}
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.editor {
  width: 100%;
  min-height: 380px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px 14px;
  resize: vertical;
}
.editor:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
.preview-pane {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 380px;
  background: var(--card);
}
.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.editor-fields label.wide { grid-column: 1 / -1; }
.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  margin: 4px 0 2px;
  cursor: pointer;
}
.check-line input { accent-color: var(--accent); width: 15px; height: 15px; }
.profile-editor { min-height: 220px; }

/* ---------------- small screens ---------------- */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .cards { grid-template-columns: 1fr; }
  .site-nav { padding-top: 10px; padding-bottom: 10px; }
  .term-window { max-width: 100%; }
  .post-title { font-size: 24px; }
  .foot-line { justify-content: flex-start; }
  .editor-fields { grid-template-columns: 1fr; }
  .editor-grid { grid-template-columns: 1fr; }
}
