:root {
  --bg: #020617;
  --card-border: rgba(148, 163, 184, 0.35);
  --accent: #6366f1;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --danger: #f97373;
  --radius-card: 20px;
  --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.9);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body.bg {
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: radial-gradient(circle at top, #0b1120 0, #020617 40%, #000 100%);
}

.app {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

@media (min-width: 768px) {
  .app {
    padding: 32px 0 64px;
  }
}

/* Nav */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: conic-gradient(
    from 180deg,
    #4f46e5,
    #22d3ee,
    #4ade80,
    #4f46e5
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.45),
    0 16px 30px rgba(15, 23, 42, 0.8);
}

.brand-logo span {
  font-size: 14px;
  font-weight: 700;
  color: #020617;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Common */

.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card,
.hero,
.article,
section.card {
  border-radius: var(--radius-card);
  border: 1px solid var(--card-border);
  background: radial-gradient(circle at top left, #020617, #020617 60%);
  box-shadow: var(--shadow-card);
  padding: 16px 16px 18px;
}

.hero {
  background: linear-gradient(145deg, #020617, #020617);
}

.hero-main .chip {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hero-main h1 {
  margin: 4px 0 6px;
  font-size: 26px;
}

.hero-main p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 12px;
}

/* Buttons */

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: 0.15s ease-out;
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #22d3ee);
  color: #020617;
  box-shadow: 0 16px 30px rgba(56, 189, 248, 0.6);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(56, 189, 248, 0.7);
}

.btn-ghost {
  border-color: rgba(148, 163, 184, 0.5);
  color: var(--text-muted);
  background: radial-gradient(circle at top left, #020617, #020617 60%);
}

.btn-ghost:hover {
  border-color: rgba(148, 163, 184, 0.9);
  color: var(--text-main);
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.link-btn.danger {
  color: var(--danger);
}

/* Posts grid */

.posts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 768px) {
  .posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.post-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: radial-gradient(circle at top left, #020617, #020617 60%);
  padding: 14px 12px 10px;
  cursor: pointer;
  transition: 0.16s ease-out;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.85);
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.95);
  border-color: rgba(129, 140, 248, 0.8);
}

.post-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.post-header h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.post-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: var(--text-muted);
}

.post-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

/* Article page */

.article {
  margin-top: 6px;
}

.article-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.article-head p {
  margin: 0 0 6px;
}

.article-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.hero-img-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.4);
  margin: 12px 0;
  max-height: 260px;
}

.hero-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-body {
  font-size: 14px;
  line-height: 1.7;
}

/* Admin layout */

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card-head h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.card-head p {
  margin: 0;
}

.field-row {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-row.inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.field-row label {
  font-size: 12px;
  color: var(--text-muted);
}

.field-row input,
.field-row textarea {
  background: #020617;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 7px 9px;
  color: var(--text-main);
  font-size: 13px;
  resize: vertical;
}

.field-row input:focus,
.field-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.55);
}

.inline-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.actions {
  display: flex;
  gap: 8px;
}

.error {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.7);
  color: var(--danger);
  font-size: 12px;
}

/* Post list in admin */

.full-width {
  grid-column: 1 / -1;
}

.posts-list {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  cursor: pointer;
  background: radial-gradient(circle at top left, #020617, #020617 60%);
}

.post-row:hover {
  border-color: rgba(129, 140, 248, 0.8);
}

.post-row-title {
  font-size: 14px;
}

.post-row-sub {
  margin-top: 2px;
}

.post-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Misc */

.empty {
  margin-top: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  text-align: center;
}

.hidden {
  display: none !important;
}
