/* =========================================================
   style.css  —  how the site LOOKS
   Change the colors in :root to restyle the whole site.
   ========================================================= */

:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --text: #1d2421;
  --muted: #5f6b66;
  --line: #dfe3df;
  --accent: #2f4fa8;
  --accent-soft: #e6ebf7;
  --serif: "Literata", Georgia, serif;
  --sans: "Familjen Grotesk", system-ui, sans-serif;
}

/* Dark mode: used automatically if the visitor's device is in dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151917;
    --surface: #1c211f;
    --text: #e7ebe8;
    --muted: #9aa6a0;
    --line: #2c3430;
    --accent: #94acf0;
    --accent-soft: #232c45;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); }

/* Keeps content in a centered column */
.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 6px 10px;
  border-radius: 999px;
}
nav a:hover { color: var(--text); }
nav a.active { color: var(--accent); background: var(--accent-soft); }

/* ---------- About me ---------- */
.hero {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  padding: 56px 0 24px;
}
.photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--accent-soft);
}
.hero-text { min-width: 0; }
.hero-text h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1.1;
  margin: 0 0 18px;
}

/* All About paragraphs look the same */
.bio {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--text);
}
.bio p { margin: 0 0 1em; text-wrap: pretty; }
.bio .welcome { font-style: italic; margin-top: 1.4em; }

/* ---------- Section labels ---------- */
.label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 500;
  margin: 40px 0 12px;
}

/* ---------- Links ---------- */
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a {
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
}
.links a:hover { border-color: var(--accent); }

/* ---------- Search box ---------- */
.search { margin: 0 0 16px; }
.search input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); }

/* ---------- Article list ---------- */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); }
.list a {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 16px 0;
  text-decoration: none;
  color: var(--text);
}
.list .date { color: var(--muted); font-size: 0.85rem; width: 6.5rem; flex-shrink: 0; }
.list .title { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; flex: 1; }
.list a:hover .title { color: var(--accent); }
.tag {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 9px;
  border-radius: 999px;
}

footer { border-top: 1px solid var(--line); margin-top: 64px; }
footer .wrap { padding-top: 24px; padding-bottom: 24px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Article page ---------- */
.back {
  display: inline-block;
  margin-top: 32px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.back:hover { color: var(--accent); }
article h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 5.5vw, 2.6rem);
  line-height: 1.15;
  margin: 24px 0 12px;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 36px;
}
.prose { font-family: var(--serif); font-size: 1.14rem; line-height: 1.75; }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-family: var(--sans); font-size: 1.1rem; margin: 2em 0 0.6em; }
.prose h3 { font-family: var(--sans); font-size: 1rem; margin: 1.6em 0 0.5em; }
.prose blockquote {
  margin: 1.6em 0;
  padding-left: 1.1em;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--muted);
}
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
.endmark { text-align: center; color: var(--muted); letter-spacing: 0.5em; margin: 40px 0 16px; }
.note, .empty { color: var(--muted); font-size: 0.9rem; }
.empty { padding: 16px 0; }

/* ---------- Write page (only on your computer) ---------- */
.write-page { padding-top: 32px; }
.page-title { font-family: var(--serif); font-weight: 400; font-size: 2rem; margin: 0 0 24px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field label { font-size: 0.85rem; font-weight: 500; }
.hint { color: var(--muted); font-weight: 400; margin-left: 6px; }
.field input, .field textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
#title { font-family: var(--serif); font-size: 1.3rem; }

.ql-toolbar.ql-snow { border: 1px solid var(--line); border-radius: 8px 8px 0 0; background: var(--surface); }
.ql-container.ql-snow {
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  font-family: var(--serif);
  font-size: 1.1rem;
}
.ql-editor { min-height: 360px; line-height: 1.7; color: var(--text); }
.ql-editor.ql-blank::before { color: var(--muted); font-style: normal; }
.ql-snow .ql-stroke { stroke: var(--muted); }
.ql-snow .ql-fill { fill: var(--muted); }
.ql-snow .ql-picker { color: var(--muted); }

.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.small { padding: 6px 14px; font-size: 0.85rem; }
.btn.danger { color: #b3261e; }
.btn.danger.confirming { background: #b3261e; border-color: #b3261e; color: #fff; }

.message { padding: 12px 16px; border-radius: 8px; font-size: 0.95rem; }
.message.success { background: var(--accent-soft); }
.message.error { background: #fbe9e7; color: #8a2a1a; }

/* Upload box */
.import-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  margin-bottom: 24px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.import-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.import-text .hint { margin-left: 0; font-size: 0.88rem; }

/* Dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dash-head .page-title { margin: 0; }
.dash-counts { color: var(--muted); margin: 8px 0 24px; }
.dash-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); }
.dash-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.dash-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.dash-title { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.dash-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.85rem; }
.dash-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status { font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.status.published { background: var(--accent-soft); color: var(--accent); }
.status.draft { background: #fdf0d5; color: #8a5a00; }

@media (prefers-color-scheme: dark) {
  .message.error { background: #3a1f1a; color: #f2b8ab; }
  .status.draft { background: #3a2e14; color: #f0c674; }
  .btn.danger { color: #f2b8b5; }
}

/* ---------- Phones ---------- */
@media (max-width: 560px) {
  .hero { flex-direction: column; padding-top: 32px; }
  .photo { width: 110px; height: 110px; }
  .list a { flex-wrap: wrap; gap: 4px 12px; }
  .list .title { flex-basis: 100%; order: 2; }
}