:root {
  --ink: #18211f;
  --muted: #64716d;
  --line: #dfe7e3;
  --paper: #f8faf7;
  --white: #ffffff;
  --accent: #0f7b68;
  --accent-strong: #0a5d51;
  --gold: #c99d39;
  --rose: #b4535a;
  --shadow: 0 22px 70px rgba(26, 43, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 123, 104, 0.08), transparent 420px),
    var(--paper);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

main {
  min-height: 68vh;
}

.site-header,
.site-footer,
.hero,
.content-grid,
.filters,
.article,
.related,
.admin-shell,
.empty-state {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--ink);
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 22px;
  color: var(--muted);
  font-weight: 700;
}

.site-nav a:hover {
  color: var(--accent);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 32px;
  align-items: stretch;
  padding: 34px 0 28px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(2.6rem, 6vw, 5.9rem);
  letter-spacing: 0;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 650px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  max-width: 620px;
  margin-top: 30px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-form input {
  border: 0;
}

.featured {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.featured img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
}

.featured div {
  position: absolute;
  inset: auto 0 0;
  padding: 30px;
  color: white;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.76));
}

.featured span,
.meta a,
.meta span,
.meta time {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
}

.featured h2 {
  margin-top: 10px;
  font-size: 2rem;
}

.featured p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 0 32px;
}

.filters a,
.tags a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 700;
}

.filters a.active,
.filters a:hover,
.tags a:hover,
.tags a.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 34px;
  align-items: start;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.post-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.post-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(26, 43, 38, 0.06);
}

.post-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-card-body {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.post-card h2 {
  font-size: 1.24rem;
}

.post-card p,
.sidebar p,
.admin-top p,
.muted {
  margin: 0;
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags a {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.listing-head,
.section-head {
  margin-bottom: 22px;
}

.listing-head h2,
.section-head h2 {
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.listing-head p:not(.eyebrow),
.section-head p:not(.eyebrow) {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.pagination a {
  display: inline-flex;
  min-width: 42px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}

.pagination a.active,
.pagination a:hover {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 800;
}

.tag-cloud a:hover,
.tag-cloud a.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.tag-cloud span {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(15, 123, 104, 0.12);
  font-size: 0.72rem;
}

.tag-cloud a:hover span,
.tag-cloud a.active span {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.tag-cloud.large a {
  padding: 10px 14px;
  font-size: 0.95rem;
}

.article-tags {
  margin-top: 18px;
}

.quick-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.quick-links > div,
.tag-index {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 30px rgba(26, 43, 38, 0.06);
}

.quick-links h2 {
  margin-bottom: 14px;
  font-size: 1.25rem;
}

.sidebar {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.sidebar section,
.admin-card,
.stats > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 30px rgba(26, 43, 38, 0.06);
}

.sidebar h2,
.admin-card h2 {
  margin-bottom: 12px;
  font-size: 1.12rem;
}

.topic-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--accent);
  font-weight: 800;
}

.article {
  padding-top: 36px;
}

.article-hero {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 34px;
  align-items: center;
}

.article-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
}

.article-hero p {
  color: var(--muted);
  font-size: 1.08rem;
}

.article-hero img {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.article-body {
  width: min(780px, 100%);
  margin: 48px auto 0;
  color: #26312e;
  font-size: 1.08rem;
}

.article-body h2 {
  margin: 42px 0 14px;
  font-size: 2rem;
}

.article-body h3 {
  margin: 32px 0 10px;
}

.article-body a {
  color: var(--accent);
  font-weight: 800;
}

.article-body blockquote {
  margin: 28px 0;
  border-left: 4px solid var(--accent);
  padding: 4px 0 4px 20px;
  color: var(--muted);
}

.related,
.empty-state {
  padding: 56px 0;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 70px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer p {
  max-width: 560px;
  margin: 6px 0 0;
}

.admin-shell {
  padding: 36px 0;
}

.admin-shell.narrow {
  display: grid;
  min-height: 58vh;
  place-items: center;
}

.admin-top,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-top {
  margin-bottom: 22px;
}

.admin-top h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
}

.ghost,
.button.ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.ghost:hover,
.button.ghost:hover {
  color: #fff;
  background: var(--ink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stats strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-weight: 700;
}

.admin-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 22px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 16px;
}

.alert {
  border: 1px solid rgba(180, 83, 90, 0.32);
  border-radius: 8px;
  padding: 12px 14px;
  color: #842f37;
  background: rgba(180, 83, 90, 0.08);
}

.post-table {
  display: grid;
  gap: 10px;
}

.post-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.post-row span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--accent);
  font-weight: 800;
}

.row-actions form {
  margin: 0;
}

.link-danger {
  min-height: auto;
  padding: 0;
  color: var(--rose);
  background: transparent;
}

.link-danger:hover {
  color: #842f37;
  background: transparent;
  transform: none;
}

.editor {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 22px;
  align-items: start;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.body-editor {
  min-height: 620px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

.login-card {
  width: min(420px, 100%);
}

.empty-state {
  text-align: center;
}

.empty-state h1 {
  font-size: clamp(2.2rem, 4vw, 4rem);
}

@media (max-width: 920px) {
  .hero,
  .content-grid,
  .article-hero,
  .admin-layout,
  .editor {
    grid-template-columns: 1fr;
  }

  .featured {
    min-height: 430px;
  }

  .sidebar {
    position: static;
  }

  .post-grid.compact {
    grid-template-columns: 1fr;
  }

  .quick-links {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .site-header,
  .site-footer,
  .admin-top,
  .admin-actions,
  .post-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
  }

  .hero h1 {
    font-size: 2.55rem;
  }

  .search-form,
  .post-grid,
  .stats,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .featured div {
    padding: 22px;
  }

  .article-hero img {
    aspect-ratio: 16 / 10;
  }
}
