:root {
  color-scheme: light dark;
  --text: #242424;
  --muted: #666;
  --bg: #fdfdfb;
  --accent: #242424;
  --border: #e3e1db;
  --link: #4b2632;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e8e6e1;
    --muted: #999;
    --bg: #17161a;
    --accent: #e8e6e1;
    --border: #333;
    --link: #cf9fae;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 120%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'source-serif-pro', Georgia, Cambria, 'Times New Roman', Times, serif;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.06px;
}

.site-header {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}

.site-title-image {
  display: block;
  height: 5.5rem;
  width: auto;
  margin-left: -1rem;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 400;
  margin: 1rem 0 2rem;
}

.entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.entry-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.entry-list-title {
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
}

.entry-list-date {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.entry-title {
  font-size: 1.8rem;
  font-weight: 400;
  margin: 1rem 0 0.25rem;
}

.entry-date {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.entry-body p {
  margin: 0 0 1.25rem;
}

.entry-body a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Reader-facing link hover: nudge right, reveal a dot growing from its center
   in the gap the nudge just opened up. */
.entry-list-title,
.entry-body a {
  position: relative;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.entry-list-title::before,
.entry-body a::before {
  content: '';
  position: absolute;
  left: -0.6em;
  top: 50%;
  width: 0.32em;
  height: 0.32em;
  border-radius: 50%;
  background: currentColor;
  transform: translateY(-50%) scale(0);
  transform-origin: center;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.entry-list-title:hover,
.entry-body a:hover {
  transform: translateX(0.6em);
}

.entry-list-title:hover::before,
.entry-body a:hover::before {
  transform: translateY(-50%) scale(1);
}

.entry-body blockquote {
  border-left: 3px solid var(--border);
  margin: 1.5rem 0;
  padding-left: 1rem;
  color: var(--muted);
}

.entry-body h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin: 2rem 0 1rem;
}

.entry-body h3 {
  font-size: 1.15rem;
  font-weight: 400;
  margin: 1.75rem 0 0.75rem;
}

.entry-body ul,
.entry-body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.entry-body li {
  margin-bottom: 0.4rem;
}

.entry-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  row-gap: 0.75rem;
  column-gap: 1rem;
  font-size: 0.95rem;
}

.entry-nav a {
  color: var(--text);
  text-decoration: none;
  min-width: min(max-content, 100%);
}

.entry-nav-text {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.entry-nav-prev:hover .entry-nav-text {
  transform: translateX(0.4em);
}

.entry-nav-next {
  text-align: right;
}

.entry-nav-next:hover .entry-nav-text {
  transform: translateX(-0.4em);
}

.empty {
  color: var(--muted);
}

.site-footer {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* --- Admin --- */

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 32rem;
}

.admin-form label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.admin-form input[type="text"],
.admin-form input[type="password"] {
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

/* Title reads like the published .entry-title while editing, rather than a
   generic boxed input -- the underline only appears on hover/focus so the
   field still reads as editable. */
.admin-form input.title-input {
  font-family: 'source-serif-pro', Georgia, Cambria, 'Times New Roman', Times, serif;
  font-size: 1.8rem;
  font-weight: 400;
  padding: 0.25rem 0;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
}

.admin-form input.title-input:hover,
.admin-form input.title-input:focus {
  border-bottom-color: var(--border);
}

.admin-form input.title-input:focus {
  outline: none;
}

/* Fixed light surface regardless of site theme -- Quill's snow theme assumes light chrome.
   Content typography mirrors .entry-body so the editor shows entries exactly as
   readers will see them published, not Quill's default sans-serif styling.
   .ql-editor is also used (unstyled by Quill JS) as the styling hook on the static
   editor mockup in preview.html, so the two never drift apart. */
.editor-surface {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #ccc;
}

.editor-surface .ql-editor {
  font-family: 'source-serif-pro', Georgia, Cambria, 'Times New Roman', Times, serif;
  font-size: 1.25rem;
  line-height: 1.6;
  letter-spacing: -0.06px;
  min-height: 16rem;
  padding: 1.5rem;
}

.editor-surface .ql-editor p {
  margin: 0 0 1.25rem;
}

.editor-surface .ql-editor h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin: 2rem 0 1rem;
}

.editor-surface .ql-editor h3 {
  font-size: 1.15rem;
  font-weight: 400;
  margin: 1.75rem 0 0.75rem;
}

.editor-surface .ql-editor blockquote {
  border-left: 3px solid #e3e1db;
  margin: 1.5rem 0;
  padding-left: 1rem;
  color: #666;
  font-style: normal;
}

.editor-surface .ql-editor a {
  color: #4b2632;
}

.editor-surface .ql-editor ul,
.editor-surface .ql-editor ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

.editor-surface .ql-editor li {
  margin-bottom: 0.4rem;
}

/* Static stand-in for Quill's real toolbar, used only on the style-preview page --
   Quill renders its own icons via JS, so this is a rough visual reference, not a
   pixel match. */
.mockup-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid #ccc;
}

.mockup-toolbar-group {
  display: flex;
  gap: 0.25rem;
  padding-right: 0.75rem;
  margin-right: 0.25rem;
  border-right: 1px solid #eee;
}

.mockup-toolbar-group:last-child {
  border-right: none;
}

.mockup-toolbar button {
  font: inherit;
  font-size: 0.8rem;
  line-height: 1;
  height: 1.7rem;
  min-width: 1.7rem;
  padding: 0.2rem 0.3rem;
  border: none;
  border-radius: 0;
  background: none;
  color: #444;
  cursor: default;
}

.mockup-toolbar button.is-active {
  color: #06c;
}

.admin-form button[type="submit"] {
  margin-top: 1.5rem;
  align-self: flex-start;
  font: inherit;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}

.button, .button-link {
  font: inherit;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.9rem;
  background: transparent;
  cursor: pointer;
}

.inline-form {
  display: inline;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table tr {
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 0.9rem 0;
  vertical-align: top;
}

.admin-table-date {
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-table-actions {
  text-align: right;
  white-space: nowrap;
}

.admin-table-actions a,
.admin-table-actions button {
  margin-left: 0.75rem;
}

.form-error {
  color: #b3261e;
}
