:root {
  --bg: #1a1f1b;
  --text: #e0e0e0;
  --text-muted: #999999;
  --link: #ffffff;
  --link-hover: #cccccc;
  --border: #2d332e;
  --danger: #888888;
  --input-bg: #252a26;
  --input-border: #3d4a3e;

  /* Lexxy editor dark mode overrides */
  --lexxy-color-ink: oklch(90% 0 0);
  --lexxy-color-ink-medium: oklch(70% 0 0);
  --lexxy-color-ink-light: oklch(50% 0 0);
  --lexxy-color-ink-lighter: oklch(30% 0 0);
  --lexxy-color-ink-lightest: oklch(15% 0 0);
  --lexxy-color-ink-inverted: black;
  --lexxy-color-canvas: var(--bg);
  --lexxy-color-text: var(--text);
  --lexxy-color-text-subtle: var(--text-muted);
  --lexxy-color-code-bg: #1a1a1a;
  --lexxy-color-code-token-att: #ff7b72;
  --lexxy-color-code-token-comment: #8b949e;
  --lexxy-color-code-token-function: #d2a8ff;
  --lexxy-color-code-token-operator: #ff7b72;
  --lexxy-color-code-token-property: #79c0ff;
  --lexxy-color-code-token-punctuation: #c9d1d9;
  --lexxy-color-code-token-selector: #7ee787;
  --lexxy-color-code-token-variable: #ffa657;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --text-muted: #666666;
    --link: #000000;
    --link-hover: #555555;
    --border: #eeeeee;
    --danger: #666666;
    --input-bg: #f5f5f5;
    --input-border: #d0d0d0;
  }
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

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

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

.container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
}

/* Header */
.site-header {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  text-decoration: none;
  font-size: 1rem;
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.nav-button {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0;
  font-weight: normal;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
}

/* Typography */
h1,
h2,
h3 {
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
}

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

.font-small {
  font-size: 0.875rem;
}

/* Post List */
.post-list {
  margin-top: 2rem;
}

.post-item {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.post-item-title {
  font-size: 1.125rem;
  margin: 0;
  font-weight: 400;
}

.post-item-title a {
  text-decoration: none;
}

.post-item-date {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* Admin Nav */
.admin-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-nav .nav-link,
.admin-nav .nav-button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 0.25rem;
}

.admin-nav .nav-link:hover,
.admin-nav .nav-button:hover {
  background: var(--border);
}

/* Admin Post List */
.admin-post-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.admin-post-meta {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.admin-post-actions {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
}

.action-delete {
  background: none;
  border: none;
  color: var(--danger);
  padding: 0;
  font-weight: normal;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.875rem;
  font-family: inherit;
}

/* Post Detail */
.post-header {
  margin-bottom: 3rem;
}

.post-title {
  font-size: 2.25rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.post-content {
  font-size: 1.125rem;
  line-height: 1.7;
}

.post-categories {
  margin-top: 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.category-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--border);
  color: var(--text);
  font-size: 0.875rem;
  border-radius: 1rem;
  text-decoration: none;
}

.category-pill:hover {
  background: var(--text-muted);
  color: var(--bg);
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="datetime-local"],
textarea {
  width: 100%;
  padding: 0.5rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  border-radius: 0.25rem;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="datetime-local"]:focus,
textarea:focus {
  border-color: var(--text-muted);
}

textarea {
  min-height: 400px;
  resize: vertical;
}

input[type="submit"] {
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Auth / Minimal Card */
.auth-container {
  width: 100%;
  max-width: 400px;
  margin-top: 4rem;
}

.alert {
  color: #ef4444;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.notice {
  color: #22c55e;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

/* Tom-select */
.ts-wrapper {
  margin-bottom: 1.5rem;
}

.ts-control,
.ts-dropdown {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 0.25rem;
}

.ts-control {
  padding: 0.5rem;
}

.ts-dropdown {
  border: 1px solid var(--input-border);
  margin-top: 0.25rem;
}

.ts-dropdown .option {
  padding: 0.5rem;
}

.ts-dropdown .option.active {
  background: var(--text-muted);
  color: var(--bg);
}

.ts-wrapper.single .ts-control::after {
  border-color: var(--text-muted) transparent transparent transparent;
}

.ts-wrapper.multi .ts-control > div {
  background: var(--border);
  color: var(--text);
  border: none;
  padding: 0.25rem 0.5rem;
  margin: 0.125rem 0.25rem 0.125rem 0;
}

.ts-wrapper.multi .ts-control > div .remove {
  border-left: 1px solid var(--bg);
  color: var(--text-muted);
}

.lexxy-editor__content {
  background-color: var(--input-bg);
}
