/* ---------------------------------------------------------------------
   Logbook — a quiet, chronological feed.
   Palette: warm paper + ink, moss accent, ember reserved for likes only.
   Type: Fraunces (display) / Inter (body) / IBM Plex Mono (timestamps, log).
--------------------------------------------------------------------- */

:root {
  --bg: #f2f2ec;
  --surface: #fbfaf6;
  --ink: #201f1b;
  --ink-soft: #6f6c62;
  --ink-faint: #9c988c;
  --hairline: #ded9cc;
  --accent: #4f6b56;
  --accent-ink: #fbfaf6;
  --ember: #b8593f;
  --radius-s: 6px;
  --radius-m: 10px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

a { color: inherit; text-decoration: none; }

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

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
  padding: 18px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}

.wordmark {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 21px;
  letter-spacing: 0.01em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topnav-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

/* -------------------------------------------------------------------- page */

.page {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ------------------------------------------------------------------ avatar */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--hairline);
  flex-shrink: 0;
}
.avatar-tiny  { width: 24px; height: 24px; font-size: 11px; }
.avatar-small { width: 30px; height: 30px; font-size: 12px; }
.avatar-large { width: 64px; height: 64px; font-size: 22px; }
.avatar-fallback {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink-soft);
}

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

label { display: block; }

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  resize: vertical;
}
textarea { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-s);
  padding: 9px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); border: 1px solid var(--hairline); color: var(--ink); }
.btn-block { width: 100%; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.link-button:hover { color: var(--ink); }
.link-button-accent { color: var(--accent); }

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
}
.pill-muted { background: var(--hairline); color: var(--ink-soft); }

/* --------------------------------------------------------------- auth page */

.auth-wrap {
  max-width: 320px;
  margin: 12vh auto 0;
  text-align: center;
}
.auth-wordmark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 34px;
  margin: 0 0 4px;
}
.auth-tagline {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 28px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
.auth-form label span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.auth-footnote {
  color: var(--ink-faint);
  font-size: 12px;
  margin-top: 22px;
}
.form-error {
  background: #f3e3dd;
  color: var(--ember);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  margin: 0;
}

/* -------------------------------------------------------------- composer */

.composer {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-m);
  padding: 14px;
  margin-bottom: 30px;
}
.composer textarea {
  border: none;
  padding: 4px 2px;
  background: none;
}
.composer textarea:focus { outline: none; }
.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}
.file-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}
.file-label input { display: none; }
.composer-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.composer-previews:empty { margin: 0; }
.preview-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-s);
  overflow: hidden;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
/* ------------------------------------------------------------------ notice */

.notice {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-m);
  margin-bottom: 24px;
  overflow: hidden;
}
.notice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13.5px;
  background: var(--surface);
}
.notice-row + .notice-row { border-top: 1px solid var(--hairline); }

/* ------------------------------------------------------------- day divider */

.day-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 16px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.day-divider::before,
.day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}
.feed > .day-divider:first-child { margin-top: 0; }

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

.feed { display: flex; flex-direction: column; gap: 26px; }

.post {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--hairline);
}
.feed .post:last-child { border-bottom: none; padding-bottom: 0; }

.post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.post-author {
  display: flex;
  align-items: center;
  gap: 9px;
}
.post-author-name {
  font-size: 14px;
  font-weight: 600;
}
.post-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}

.post-images {
  display: grid;
  gap: 3px;
  border-radius: var(--radius-m);
  overflow: hidden;
  margin-bottom: 10px;
}
.post-images a { display: block; width: 100%; height: 100%; }
.post-images img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--hairline); }
.post-images-1 { grid-template-columns: 1fr; }
.post-images-1 img { max-height: 520px; }
.post-images-2 { grid-template-columns: 1fr 1fr; aspect-ratio: 16/9; }
.post-images-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 16/9; }
.post-images-3 a:first-child { grid-row: 1 / 3; }
.post-images-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1/1; }

.post-caption {
  margin: 0 0 10px;
  font-size: 14.5px;
  white-space: pre-wrap;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.like-button {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 4px 0;
}
.like-glyph { font-size: 15px; line-height: 1; }
.like-button.liked { color: var(--ember); }
.like-button.liked .like-glyph { color: var(--ember); }

.post-action-sep { color: var(--ink-faint); }
.comment-count { font-size: 13px; color: var(--ink-faint); }

.comment-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comment-list li { font-size: 13.5px; }
.comment-author { font-weight: 600; margin-right: 5px; }

.comment-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.comment-form input {
  border: none;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  padding: 4px 2px;
  font-size: 13.5px;
  background: none;
}
.comment-form input:focus { outline: none; border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- profile */

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 34px;
}
.profile-info { flex: 1; min-width: 0; }
.profile-info h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}
.profile-username { color: var(--ink-faint); font-size: 13px; margin: 2px 0 8px; }
.profile-bio { font-size: 14px; margin: 0 0 8px; }
.profile-meta { font-size: 12.5px; color: var(--ink-soft); margin: 0; }

.edit-details summary { list-style: none; cursor: pointer; }
.edit-details summary::-webkit-details-marker { display: none; }
.edit-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 200px;
}
.edit-form textarea { min-height: 60px; font-size: 13px; }

/* -------------------------------------------------------------- empty state */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}
.empty-sub { font-size: 13px; color: var(--ink-faint); }

/* ------------------------------------------------------------------ mobile */

@media (max-width: 480px) {
  .page { padding: 18px 16px 70px; }
  .topbar { padding: 14px 16px; }
  .profile-head { flex-wrap: wrap; }
  .profile-action { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
