/* ====== Reset ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ====== Theme variables ====== */
:root {
  --bg-color: #fafafa;
  --text-color: #111827;
  --muted-color: #6b7280;
  --border-color: #e5e7eb;
  --accent-color: #2563eb;
  --soft-bg: #ffffff;
}

body.dark {
  --bg-color: #020617;
  --text-color: #e5e7eb;
  --muted-color: #9ca3af;
  --border-color: #1f2937;
  --accent-color: #60a5fa;
  --soft-bg: #020617;
}

/* ====== Base layout ====== */
html, body {
  min-height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.7;
  background: var(--bg-color);
  color: var(--text-color);
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ====== Header ====== */
.site-header {
  background: var(--soft-bg);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-weight: bold;
  text-decoration: none;
  color: var(--text-color);
}

.logo span {
  color: var(--accent-color);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav a {
  text-decoration: none;
  color: var(--muted-color);
  font-size: 0.9rem;
}

.nav a:hover {
  color: var(--text-color);
}

/* Dark mode toggle button */
.theme-toggle {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--muted-color);
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text-color);
}

/* ====== Homepage hero ====== */
.hero-home {
  padding: 2.5rem 0 1.5rem;
}

.hero-text h1 {
  font-size: 2.4rem;
  margin-bottom: 0.3rem;
}

.hero-text p {
  max-width: 35rem;
  color: var(--muted-color);
}

/* ====== Posts list (no boxes, line between posts) ====== */
.posts-grid {
  display: flex;
  flex-direction: column;
  padding-bottom: 3rem;
}

/* One clean line between posts via border-top */
.post-card {
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
}

.post-card:first-of-type {
  border-top: none;
}

.post-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.post-card-meta {
  font-size: 0.85rem;
  color: var(--muted-color);
  margin-bottom: 0.9rem;
}

.post-card-excerpt {
  font-size: 1rem;
  color: var(--text-color);
  margin-bottom: 1.1rem;
  line-height: 1.7;
}

.post-card-tags {
  font-size: 0.85rem;
  color: var(--muted-color);
  margin-bottom: 0.9rem;
}

.tag-pill {
  background: rgba(148, 163, 184, 0.2);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.3rem;
}

.post-card-read {
  color: var(--accent-color);
  font-size: 0.9rem;
}

/* No hover animations on posts (intentionally empty hover) */
.post-card:hover {}

/* ====== Single post page ====== */
.article-page {
  margin: 3rem auto;
}

.article-header {
  margin-bottom: 1.5rem;
}

.article-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-color);
  margin-bottom: 0.25rem;
}

.article-title {
  font-size: 2.2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.article-meta {
  color: var(--muted-color);
  font-size: 0.85rem;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.article-body {
  font-size: 1.05rem;
  color: var(--text-color);
  line-height: 1.8;
  background: var(--soft-bg);
  padding: 1.25rem 0;
}

.article-body p {
  margin-bottom: 1.3rem;
}

.article-body h2 {
  margin: 2rem 0 1rem;
  font-size: 1.4rem;
}

.article-body ul,
.article-body ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.article-footer {
  margin-top: 2rem;
}

/* Back link */
.back-link {
  display: inline-block;
  color: var(--accent-color);
  text-decoration: none;
  margin-top: 0.5rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* ====== NYT-style About page ====== */
.nyt-article {
  max-width: 720px;
  margin: 2.5rem auto 4rem;
  padding: 0 1rem;
}

.nyt-section-label {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-color);
  margin-bottom: 0.75rem;
}

.nyt-headline {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 2.2rem;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.75rem;
}

.nyt-deck {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--muted-color);
  max-width: 38rem;
  margin-bottom: 1.5rem;
}

.nyt-byline-block {
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 0;
  margin-bottom: 1.75rem;
}

.nyt-byline {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-color);
}

.nyt-byline span {
  font-weight: 600;
}

.nyt-dateline {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8rem;
  color: var(--muted-color);
  margin-top: 0.25rem;
}

.nyt-article-body {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--text-color);
}

.nyt-article-body p {
  margin-bottom: 1.1rem;
}

.nyt-article-body .dropcap::first-letter {
  float: left;
  font-size: 3.2rem;
  line-height: 0.9;
  padding-right: 0.25rem;
  padding-top: 0.15rem;
  font-weight: 700;
}

/* ====== Footer ====== */
.site-footer {
  font-size: 0.8rem;
  color: var(--muted-color);
  text-align: center;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
}

/* ====== Admin (kept simple) ====== */
.admin-wrapper {
  padding: 2rem 0 3rem;
}

.admin-wrapper h1 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.admin-actions {
  margin-bottom: 1rem;
}

.admin-button {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--accent-color);
  background: var(--accent-color);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
}

.admin-button:hover {
  opacity: 0.9;
}

.admin-link,
.admin-link-small {
  text-decoration: none;
  color: var(--accent-color);
  font-size: 0.9rem;
}

.admin-link-small {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

.admin-delete-button {
  color: #b91c1c;
}

.admin-link:hover,
.admin-link-small:hover {
  text-decoration: underline;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  background: var(--soft-bg);
  border-radius: 0.5rem;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.admin-table th {
  background: rgba(148, 163, 184, 0.08);
  font-weight: 600;
}

.admin-form {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-form label {
  font-size: 0.9rem;
  color: var(--text-color);
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form textarea {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--soft-bg);
  color: var(--text-color);
}

.admin-form textarea {
  resize: vertical;
}

.admin-form-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.login-error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* ====== Responsive ====== */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .article-title {
    font-size: 1.8rem;
  }
}
.error-page {
    text-align: center;
    padding: 4rem 0 5rem;
}

.error-page h1 {
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.error-page h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.error-page p {
    font-size: 1rem;
    color: var(--muted-color);
    margin-bottom: 2rem;
}

.home-button {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--accent-color);
    color: white;
    border-radius: 0.4rem;
    text-decoration: none;
    font-size: 0.95rem;
}

.home-button:hover {
    opacity: 0.9;
}

/* ====== Floating Dark Mode Button (Top-Right Corner) ====== */
.floating-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--soft-bg);
  color: var(--text-color);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.floating-theme-toggle:hover {
  background: var(--border-color);
}
.admin-error {
  color: #b91c1c;
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

.field-help {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted-color);
}

.field-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}