:root {
  --radius: 10px;
  --radius-sm: 6px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-read: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --max-width: 52rem;
  --header-h: 3.25rem;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1eb;
  --bg-subtle: #ebe6dd;
  --surface: #fffcf8;
  --text: #1c1917;
  --muted: #78716c;
  --border: #ddd6cb;
  --border-strong: #c9bfb0;
  --accent: #292524;
  --accent-hover: #44403c;
  --link: #292524;
  --link-hover: #44403c;
  --pill-bg: #ebe6dd;
  --pill-active: #292524;
  --pill-active-text: #fafaf9;
  --error: #b91c1c;
  --error-hover: #991b1b;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --success: #3f6212;
  --success-bg: #f7fee7;
  --success-border: #d9f99d;
  --highlight: #fef9c3;
  --highlight-border: #fde047;
  --highlight-ring: rgba(253, 224, 71, 0.35);
  --tg-badge-bg: #dbeafe;
  --tg-badge-text: #1e40af;
  --header-bg: rgba(244, 241, 235, 0.92);
  --focus-ring: rgba(41, 37, 36, 0.08);
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow-md: 0 4px 16px rgba(28, 25, 23, 0.07);
  --theme-color: #f4f1eb;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c1917;
  --bg-subtle: #292524;
  --surface: #292524;
  --text: #fafaf9;
  --muted: #a8a29e;
  --border: #44403c;
  --border-strong: #57534e;
  --accent: #e7e5e4;
  --accent-hover: #fafaf9;
  --link: #d6d3d1;
  --link-hover: #fafaf9;
  --pill-bg: #44403c;
  --pill-active: #e7e5e4;
  --pill-active-text: #1c1917;
  --error: #f87171;
  --error-hover: #ef4444;
  --error-bg: rgba(127, 29, 29, 0.35);
  --error-border: rgba(248, 113, 113, 0.35);
  --success: #a3e635;
  --success-bg: rgba(63, 98, 18, 0.35);
  --success-border: rgba(163, 230, 53, 0.3);
  --highlight: rgba(254, 249, 195, 0.12);
  --highlight-border: rgba(253, 224, 71, 0.45);
  --highlight-ring: rgba(253, 224, 71, 0.2);
  --tg-badge-bg: rgba(30, 64, 175, 0.45);
  --tg-badge-text: #93c5fd;
  --header-bg: rgba(28, 25, 23, 0.92);
  --focus-ring: rgba(250, 250, 249, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --theme-color: #1c1917;
}

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

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

body {
  margin: 0;
  font-family: var(--font-read);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}

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

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

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
  margin: -1.25rem -1rem 1.75rem;
  padding: 0.75rem 1rem;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-header h1 a {
  color: inherit;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--pill-bg);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}

.site-nav .logout-form { margin: 0; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--pill-bg);
  border-color: var(--border);
}

html[data-theme="light"] .theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun { display: none; }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.btn-link:hover {
  color: var(--error);
  background: var(--error-bg);
  text-decoration: none;
}

/* ── Alerts ── */
.alert {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}

.alert-success {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-border);
}

.alert-error {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error-border);
}

.error { color: var(--error); margin: 0 0 1rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.6rem 1.15rem;
  background: var(--accent);
  color: var(--pill-active-text);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  min-height: 2.75rem;
}

.btn:hover { background: var(--accent-hover); }

.btn:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-small {
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
  min-height: 2rem;
}

.btn-danger { background: var(--error); }
.btn-danger:hover { background: var(--error-hover); }

/* ── Forms ── */
.panel {
  margin-bottom: 1.75rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel-title {
  margin: 0 0 1.125rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.compose,
.panel {
  margin-bottom: 1.75rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.compose h2,
.panel h2 {
  margin: 0 0 1.125rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.compose-panel > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.25rem 0;
  user-select: none;
}

.compose-panel > summary::-webkit-details-marker { display: none; }

.compose-panel > summary::before {
  content: "+ ";
  display: inline-block;
  width: 1.1em;
  color: var(--muted);
  font-weight: 400;
  transition: transform 0.2s;
}

.compose-panel[open] > summary::before {
  content: "− ";
}

.compose-panel[open] > summary {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  gap: 0.875rem;
}

label,
.field-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}

label input,
label select,
label textarea,
.field-input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  font-family: var(--font-read);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

label input:focus,
label select:focus,
label textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--surface);
}

label textarea { resize: vertical; min-height: 6rem; }

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.75rem;
}

.description-field textarea {
  min-height: 3.5rem;
  resize: vertical;
}

.tags-field .field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.tags-field .field-label-row label {
  margin: 0;
}

.tags-field input[data-tags-input] {
  display: block;
  width: 100%;
  font-family: var(--font-read);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tags-field input[data-tags-input]:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--surface);
}

.entry-permalink {
  color: inherit;
  text-decoration: none;
}

.entry-permalink:hover {
  color: var(--text);
  text-decoration: underline;
}

.entry-edited,
.archived-badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.archived-badge {
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  background: var(--pill-bg);
}

.link-preview {
  display: flex;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  transition: border-color 0.15s;
}

.link-preview:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.link-preview-image {
  width: 5.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.link-preview-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.link-preview-title {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.link-preview-url {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-attachment {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  background: var(--surface);
}

.file-attachment:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.file-attachment-name {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-page .entry {
  margin-bottom: 0;
}

.description-field .field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.btn-ai-description {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1;
  color: var(--muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.btn-ai-description:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}

.btn-ai-description:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-ai-description.is-loading {
  animation: ai-pulse 0.9s ease-in-out infinite;
}

@keyframes ai-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.file-input-wrap {
  margin-top: 0.35rem;
  padding: 0.75rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: center;
}

.file-input-wrap input[type="file"] {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  width: 100%;
  margin: 0;
}

/* Image upload (paste / drop / multi) */
.image-upload {
  display: block;
  margin-bottom: 0.875rem;
}

.image-upload .field-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.image-upload-zone {
  position: relative;
  padding: 1.25rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.image-upload-zone:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.image-upload-zone.dragover,
.image-upload-zone.paste-flash {
  border-color: var(--accent);
  background: var(--surface);
}

.image-upload-zone.image-upload-busy {
  opacity: 0.7;
  pointer-events: none;
}

.image-upload-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.image-upload-hint {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

.image-upload-kbd {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
}

.image-upload-kbd kbd {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
}

.image-upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.image-upload-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.image-upload-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.image-upload-thumb--file {
  width: auto;
  min-width: 5.5rem;
  max-width: 10rem;
  height: auto;
  min-height: 3.25rem;
  padding: 0.5rem 1.75rem 0.5rem 0.5rem;
}

.image-upload-file {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--text);
  word-break: break-all;
  text-align: left;
}

.image-upload-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-upload-remove:hover {
  background: var(--error);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
}

/* ── Login ── */
.page-login .wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100dvh;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.page-login .site-header {
  position: static;
  background: none;
  border: none;
  margin: 0 0 1.5rem;
  padding: 0;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.page-login .site-header h1 {
  font-size: 1.75rem;
  font-family: var(--font-read);
  font-weight: normal;
}

.login-card {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form .btn { width: 100%; }

/* ── Feed toolbar (compose / search toggles) ── */
.feed-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.feed-toggle > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  color: var(--muted);
  user-select: none;
}

.feed-toggle > summary::-webkit-details-marker { display: none; }

.feed-toggle > summary:hover,
.feed-toggle[open] > summary {
  color: var(--text);
}

.feed-toggle[open] {
  flex-basis: 100%;
}

.compose-form,
.feed-toggle .search-form {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}

.search-active {
  color: var(--text);
  font-weight: 500;
}

.search-clear {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  align-self: center;
  white-space: nowrap;
}

.search-clear:hover { color: var(--text); }

/* ── Feed filters (compact) ── */
.feed-filters {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.feed-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.filter-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.filter-links-muted {
  font-size: 0.8125rem;
  color: var(--muted);
}

.filter-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.filter-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.filter-link.is-active {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.filter-links-muted .filter-link.is-active {
  color: var(--text);
}

.feed-filters-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -0.15rem;
  padding: 0.1rem 0.15rem;
}

.feed-filters-scroll::-webkit-scrollbar { display: none; }

.filter-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  width: max-content;
  max-width: 100%;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
}

@media (min-width: 640px) {
  .filter-chips {
    flex-wrap: wrap;
    width: auto;
  }
}

.filter-chip {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.filter-chip:hover {
  color: var(--text);
  border-color: var(--border);
  text-decoration: none;
}

.filter-chip.is-active {
  color: var(--text);
  font-weight: 500;
  background: var(--pill-bg);
  border-color: var(--border);
}

.filter-chips-tags .filter-chip {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

/* legacy pills (settings etc.) */

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.search-form input {
  flex: 1;
  min-width: 12rem;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.search-form input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--surface);
}

.search-form .btn {
  flex-shrink: 0;
  padding-left: 1rem;
  padding-right: 1rem;
}

.pills-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 -0.25rem;
  padding: 0.15rem 0.25rem;
}

.pills-scroll::-webkit-scrollbar { display: none; }

.pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  width: max-content;
  max-width: 100%;
}

@media (min-width: 640px) {
  .pills { flex-wrap: wrap; width: auto; }
}

.pill {
  display: inline-block;
  flex-shrink: 0;
  padding: 0.35rem 0.8rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  text-decoration: none;
  color: var(--text);
  background: var(--pill-bg);
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.pill.active {
  background: var(--pill-active);
  color: var(--pill-active-text);
  border-color: var(--pill-active);
}

.pill-tag { font-size: 0.75rem; }

/* ── Feed entries ── */
.feed-header {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.empty {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.entry {
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.entry:hover { box-shadow: var(--shadow-md); }

.entry.highlight {
  background: var(--highlight);
  border-color: var(--highlight-border);
  box-shadow: 0 0 0 3px var(--highlight-ring);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.category-badge {
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  background: var(--pill-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.via-badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.15rem 0.35rem;
  background: var(--tg-badge-bg);
  color: var(--tg-badge-text);
  border-radius: 3px;
}

.entry-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.btn-small-link {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-small-link:hover {
  color: var(--text);
  background: var(--pill-bg);
  text-decoration: none;
}

.btn-danger-link:hover {
  color: var(--error);
  background: var(--error-bg);
}

.delete-form.inline { display: inline; margin: 0; }

.entry-description {
  margin: 0.35rem 0 1rem;
  padding: 0 0 0.85rem 0.7rem;
  border-left: 2px solid var(--border-strong);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-read);
  font-size: 1.0625rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.55;
  letter-spacing: 0.012em;
  color: var(--muted);
}

.entry-body { font-size: 1.0625rem; }
.entry-body-wrap { margin-bottom: 0.25rem; }

.read-more-btn {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.read-more-btn:hover { color: var(--text); }

.entry-body p { margin: 0 0 0.85rem; }
.entry-body p:last-child { margin-bottom: 0; }

.entry-body pre {
  overflow-x: auto;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.entry-body code {
  font-size: 0.9em;
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.entry-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.85rem 0;
  font-size: 0.9375rem;
}

.entry-body th,
.entry-body td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.entry-body th {
  background: var(--bg);
  font-weight: 600;
}

.entry-body tr:nth-child(even) td {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.entry-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
  display: block;
}

.source-link {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  word-break: break-all;
}

.source-link a {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.source-link a:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 1rem 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  align-items: flex-start;
}

.gallery a {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(100%, 16rem);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
}

.gallery img,
.gallery video {
  display: block;
  max-width: 100%;
  max-height: 13rem;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.25s;
}

.gallery a:hover img,
.gallery a:hover video { transform: scale(1.02); }

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.tag {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0.55rem;
  background: var(--bg);
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.tag:hover {
  color: var(--text);
  background: var(--pill-bg);
  text-decoration: none;
}

/* ── Lightbox ── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(12, 10, 9, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}

.lightbox-overlay img,
.lightbox-overlay video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-media {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  font-family: var(--font-ui);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.5rem;
}

.lightbox-prev { left: 0.75rem; }
.lightbox-next { right: 0.75rem; }

.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Settings / admin ── */
.admin-section { margin-bottom: 2rem; }

.admin-section h2 {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.875rem;
}

.admin-form {
  margin-bottom: 0.875rem;
  padding: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inline-form input[type="text"],
.inline-form input[type="number"],
.inline-edit-form input[type="text"] {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  flex: 1;
  min-width: 8rem;
}

.inline-form input:focus,
.inline-edit-form input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-narrow {
  width: 4.5rem !important;
  flex: 0 0 auto !important;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.inline-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.slug-hint {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--muted);
  padding: 0.2rem 0.45rem;
  background: var(--bg);
  border-radius: 4px;
}

.count-badge {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 1.5rem;
  text-align: center;
}

.count-badge::before { content: "· "; opacity: 0.5; }

.admin-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.delete-form { display: inline; margin: 0; }

.admin-locked {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Edit page ── */
.back-link {
  margin: -0.5rem 0 1.25rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.back-link a {
  text-decoration: none;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0;
}

.back-link a:hover { color: var(--text); }

.entry-page-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: -0.5rem 0 1.25rem;
}

.entry-page-bar .back-link {
  margin: 0;
}

.btn-share-entry {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-share-entry:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.btn-share-entry:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-share-entry.is-copied {
  color: var(--success);
  border-color: var(--success-border);
  background: var(--success-bg);
}

.site-header--minimal {
  justify-content: center;
}

.site-header--minimal h1 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
}

.entry-page--public {
  max-width: 42rem;
  margin: 0 auto;
}

.page-public-share .wrap {
  position: relative;
}

.public-theme-bar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
}

.page-public-share .entry-page--public {
  padding-top: 2.5rem;
}

.media-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  margin-bottom: 0.875rem;
  background: var(--bg);
}

.media-fieldset legend {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0 0.35rem;
}

.media-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}

.media-edit-item {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.media-edit-item input {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--error);
}

.media-edit-item img,
.media-edit-item video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  transition: opacity 0.15s;
  background: var(--bg-subtle);
}

.media-edit-item:has(input:checked) img,
.media-edit-item:has(input:checked) video { opacity: 0.35; }
.media-edit-item:has(input:checked) {
  outline: 2px solid var(--error);
  outline-offset: -2px;
}

.btn-secondary {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.6rem 1rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.btn-secondary:hover { color: var(--text); }

/* ── Books catalog ── */
.books-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.books-hero-title {
  margin: 0;
  font-family: var(--font-read);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.books-hero-sub {
  margin: 0.35rem 0 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--muted);
}

.books-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.books-search {
  width: 100%;
  max-width: 24rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.books-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.books-search-row .books-search {
  flex: 1;
  min-width: 12rem;
}

.books-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill-soft {
  background: transparent;
}

.books-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 1.25rem 1rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.book-card-cover {
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(160deg, var(--bg-subtle), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.book-card-cover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.book-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-card-cover-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--font-read);
  font-size: 2rem;
  color: var(--muted);
}

.book-card-title {
  margin: 0;
  font-family: var(--font-read);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}

.book-card-title a {
  color: var(--text);
  text-decoration: none;
}

.book-card-title a:hover {
  color: var(--link-hover);
}

.book-card-author,
.book-card-genre {
  margin: 0.15rem 0 0;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.book-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin-top: 0.35rem;
}

.book-status {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.book-card--reading .book-status {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.book-card--read .book-status {
  color: var(--success);
  border-color: var(--success-border);
  background: var(--success-bg);
}

.book-rating {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.book-card-tags {
  margin: 0.35rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.book-card-tags .tag {
  font-size: 0.6875rem;
}

.book-form-layout {
  max-width: 44rem;
}

.book-form-header h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-read);
  font-size: 1.5rem;
}

.book-form-hint {
  margin: 0 0 1.25rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--muted);
}

.book-lookup {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.book-lookup-row {
  display: flex;
  gap: 0.5rem;
}

.book-lookup-row input {
  flex: 1;
}

.book-lookup-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  max-height: 18rem;
  overflow: auto;
}

.book-lookup-empty {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted);
}

.book-lookup-hit {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-ui);
}

.book-lookup-hit:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.book-lookup-hit-cover {
  flex-shrink: 0;
  width: 2.75rem;
  height: 4rem;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-read);
  color: var(--muted);
}

.book-lookup-hit-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-lookup-hit-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.book-lookup-hit-text strong {
  font-size: 0.875rem;
  line-height: 1.3;
}

.book-lookup-hit-text span {
  font-size: 0.75rem;
  color: var(--muted);
}

.book-lookup-hit-meta {
  font-size: 0.6875rem !important;
}

.book-form-grid {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.book-cover-preview {
  width: 100%;
  aspect-ratio: 2 / 3;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
}

.book-dropzone {
  position: relative;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.book-dropzone:hover,
.book-dropzone:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.book-dropzone.is-dragover,
.book-dropzone.paste-flash {
  border-color: var(--accent);
  background: var(--surface);
}

.book-dropzone--cover {
  overflow: hidden;
}

.book-dropzone--files {
  padding: 1rem;
  text-align: center;
}

.book-dropzone-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.book-dropzone-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text);
}

.book-dropzone-hint {
  margin: 0.35rem 0 0;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
}

.book-files-field {
  margin: 0 0 1.25rem;
}

.book-files-existing {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.5rem 0 0.75rem;
}

.book-file-existing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
}

.book-file-existing a {
  color: var(--text);
}

.book-files-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.book-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.35rem 0.45rem 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 0.75rem;
}

.book-file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-file-chip-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.book-file-chip-remove:hover {
  color: var(--error);
}

.book-card-files {
  margin: 0.4rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.book-file-link {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-file-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.book-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover-empty {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.5rem;
  text-align: center;
}

.book-cover-field input[type="file"] {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.75rem;
}

.book-remove-cover {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
}

.book-form-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.book-form-fields label,
.book-form-fields .tags-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
}

.book-form-fields input,
.book-form-fields textarea,
.book-form-fields select {
  font-weight: 400;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.book-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.book-delete-form {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.empty-state {
  font-family: var(--font-ui);
  color: var(--muted);
  margin: 2rem 0;
}

/* ── Responsive ── */
@media (max-width: 639px) {
  .wrap {
    padding: 0.75rem 1rem 3.5rem;
  }

  .site-header {
    margin: -0.75rem -1rem 1.25rem;
    padding: 0.75rem 1rem;
  }

  .entry {
    padding: 0;
    margin-bottom: 1.75rem;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .entry:hover { box-shadow: none; }

  .entry:not(:last-child) {
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
  }

  .entry.highlight {
    margin: 0 -1rem 1.75rem;
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 1px solid var(--highlight-border);
    box-shadow: none;
  }

  .empty {
    padding: 2rem 0;
    background: transparent;
    border: none;
    border-radius: 0;
  }
}

@media (min-width: 640px) {
  .wrap { padding: 1.75rem 1.5rem 5rem; }

  .site-header {
    margin: -1.75rem -1.5rem 2rem;
    padding: 0.875rem 1.5rem;
  }

  .entry { padding: 1.5rem; }

  .gallery img,
  .gallery video {
    max-height: 15rem;
  }
}

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

  .site-header h1 { font-size: 1rem; }

  .site-nav a,
  .btn-link {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
  }

  .entry-actions {
    width: 100%;
    margin-left: 0;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
  }

  .admin-item {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-item-actions {
    justify-content: flex-end;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
  }

  .search-form { flex-direction: column; }
  .search-form .btn { width: 100%; }

  .books-shelf {
    grid-template-columns: 1fr;
  }

  .book-form-grid {
    grid-template-columns: 1fr;
  }

  .book-cover-preview {
    width: 8.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
