:root {
  --bg: #161d2b;
  --bg-elevated: #1c2438;
  --fg: #e8eaf0;
  --fg-muted: #8993a8;
  --accent: #d7dbe6;
  --border: #2a324a;
  --max-width: 640px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.site-header {
  text-align: center;
  margin-bottom: 4rem;
}

.site-header__avatar {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated);
}

.site-header__name {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-decoration: none;
}

.site-header__name:hover {
  color: var(--fg);
}

.back-link {
  display: inline-block;
  margin-bottom: 3rem;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-decoration: none;
}

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

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

.post-list__item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list__item:first-child {
  padding-top: 0;
}

.post-list__date {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.post-list__title a {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 600;
}

.post-list__title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.post-list__empty {
  color: var(--fg-muted);
}

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

.post-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 2.5rem;
}

.post-body {
  font-size: 1.05rem;
}

.post-body p {
  margin: 0 0 1.4rem;
}

.post-body a {
  color: var(--fg);
  text-decoration-color: var(--fg-muted);
}

.post-body img,
.post-body video {
  max-width: 100%;
  border-radius: 6px;
}

.post-body blockquote {
  margin: 1.75rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--border);
  color: var(--fg-muted);
  font-style: italic;
}

.post-body pre {
  background: var(--bg-elevated);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
}

.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.9rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.post-footer__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.post-footer__name {
  color: var(--fg);
  font-weight: 600;
}

.admin-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  font-size: 0.8rem;
}

.admin-bar a,
.admin-bar button {
  background: none;
  border: none;
  color: var(--fg-muted);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.admin-bar a:hover,
.admin-bar button:hover {
  color: var(--fg);
}

.form-field {
  margin-bottom: 1.5rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.form-field input[type="text"],
.form-field input[type="datetime-local"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 1rem;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

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

.admin-post-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.admin-post-list__meta {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.page:has(.analytics) {
  max-width: 960px;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.period-picker {
  display: flex;
  gap: 0.25rem;
}

.period-picker__link {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
}

.period-picker__link:hover {
  color: var(--fg);
}

.period-picker__link.is-active {
  background: var(--bg-elevated);
  color: var(--fg);
}

.analytics-note {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.stat-tile {
  background: var(--bg-elevated);
  padding: 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-tile__value {
  font-size: 1.6rem;
  font-weight: 600;
}

.stat-tile__label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.analytics-section {
  margin-bottom: 2.5rem;
}

.analytics-section__title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 1rem;
}

.analytics-section__subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 1.5rem 0 0.75rem;
}

.analytics-empty {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-radius: 8px;
}

.bar-chart__bar {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.bar-chart__fill {
  width: 100%;
  min-height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.analytics-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

@media (max-width: 640px) {
  .analytics-columns {
    grid-template-columns: 1fr;
  }
}

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

.stat-list__item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.stat-list__muted {
  color: var(--fg-muted);
  font-size: 0.8rem;
}

.stat-list__count {
  color: var(--fg-muted);
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.analytics-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.analytics-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.analytics-table th:not(:first-child),
.analytics-table td:not(:first-child) {
  text-align: right;
}
