/* while vibe coding: black & white / dotted minimalist, borrowed from almighty.css */

:root {
  --bg-light: #f7f7f7;
  --bg-dark: #0a0a0a;
  --text: #0a0a0a;
  --text-inv: #ffffff;
  --muted: #666666;
  --border: rgba(0, 0, 0, 0.12);
  --max-width: 720px;
  --font-sans: "Inter", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  --dot-size: 18px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-light);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  background-image: radial-gradient(#c8c8c8 1px, transparent 1px);
  background-size: var(--dot-size) var(--dot-size);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.text-muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 0.85em; }
.hidden { display: none !important; }

/* ========== HEADER ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 247, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.logo-mark {
  width: 11px;
  height: 20px;
  background: var(--text);
  flex: none;
  animation: blink 1.1s step-end infinite;
}

@media (prefers-reduced-motion: reduce) {
  .logo-mark { animation: none; }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  object-fit: cover;
  flex: none;
}

.avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text);
  color: var(--text-inv);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex: none;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-block;
  padding: 11px 22px;
  background: var(--text);
  color: var(--text-inv);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 2px solid var(--text);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn:hover { background: transparent; color: var(--text); }
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn:disabled:hover { background: var(--text); color: var(--text-inv); }

.btn-outline {
  background: transparent;
  color: var(--text);
}
.btn-outline:hover { background: var(--text); color: var(--text-inv); }

.btn-sm {
  padding: 7px 14px;
  font-size: 0.72rem;
}

.btn-block { display: block; width: 100%; text-align: center; }

/* ========== HERO (logged out) ========== */
.hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero-excerpt {
  font-size: 1.05rem;
  margin-bottom: 28px;
  color: #333;
}

/* ========== AUTH MODAL ========== */
dialog.auth-modal {
  border: 2px solid var(--text);
  padding: 32px;
  max-width: 360px;
  width: calc(100% - 48px);
  background: var(--bg-light);
  /* The global `* { margin: 0 }` reset above cancels the browser's
     default `dialog:modal { margin: auto }` centering, which pins the
     dialog to the top-left instead. Restore it explicitly, with a
     fixed top offset instead of full vertical centering so it settles
     near the top rather than dead-center on tall viewports. */
  margin: 2em auto auto;
}

dialog.auth-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.auth-modal-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 20px;
}

.auth-provider-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-modal-close {
  display: block;
  margin: 0 auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  font-family: inherit;
  padding: 8px;
}
.auth-modal-close:hover { color: var(--text); }

/* ========== COMPOSER ========== */
.composer {
  background: #fff;
  border: 1px solid var(--border);
  padding: 20px;
  margin: 32px 0;
}

.composer textarea {
  width: 100%;
  min-height: 90px;
  border: none;
  resize: vertical;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  background: transparent;
}
.composer textarea:focus { outline: none; }

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 10px;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.image-input-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border: 1px solid var(--border);
  padding: 7px 12px;
}
.image-input-label:hover { border-color: var(--text); color: var(--text); }
.image-input-label input { display: none; }

.image-preview-wrap {
  position: relative;
  margin-top: 14px;
  display: inline-block;
}

.image-preview-wrap img {
  max-height: 220px;
  display: block;
  border: 1px solid var(--border);
}

.image-preview-remove {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  background: var(--text);
  color: var(--text-inv);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.char-counter {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.char-counter.over { color: #c0152f; font-weight: 700; }

.composer-error {
  font-size: 0.85rem;
  color: #c0152f;
  margin-top: 10px;
}

/* ========== FEED ========== */
.feed {
  padding: 8px 0 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  background: #fff;
  border: 1px solid var(--border);
  padding: 20px;
  transition: border-color 0.15s;
}
.post-card:hover { border-color: #000; }

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.post-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.post-delete-btn,
.post-share-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  flex: none;
}
.post-delete-btn:hover { color: #c0152f; }
.post-share-btn:hover { color: var(--text); }
.post-share-btn:disabled { opacity: 0.6; cursor: default; }

.post-identity { display: flex; flex-direction: column; line-height: 1.25; }

.post-handle {
  font-weight: 700;
  font-size: 0.92rem;
}

.post-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
}
a.post-time:hover { text-decoration: underline; }

.post-body {
  font-size: 0.98rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 12px;
}

.post-image {
  width: 100%;
  display: block;
  border: 1px solid var(--border);
}

.feed-empty, .feed-status {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.load-more-wrap {
  text-align: center;
  padding-top: 8px;
}

.share-row {
  display: flex;
  gap: 12px;
  margin: 24px 0 48px;
}

/* ========== ADMIN ========== */
.admin-container {
  max-width: 920px;
  padding-top: 32px;
  padding-bottom: 64px;
}

.admin-section {
  margin-bottom: 48px;
}

.admin-section-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  padding: 18px;
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 6px;
}

.admin-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table tbody tr:last-child td { border-bottom: none; }

/* ========== FOOTER ========== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
