:root {
  --ink: #172126;
  --muted: #5a676e;
  --surface: #f8fbfc;
  --panel: #ffffff;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --accent: #f97316;
  --line: #d9e3e6;
  --shadow: 0 18px 40px rgba(23, 33, 38, 0.09);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 88% -10%, rgba(249, 115, 22, 0.15), transparent 60%),
    radial-gradient(700px 360px at -10% 6%, rgba(15, 118, 110, 0.14), transparent 58%),
    var(--surface);
  line-height: 1.6;
}

a {
  color: var(--brand-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 252, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.18);
  text-decoration: none;
}

.btn.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.btn.secondary:hover {
  background: #f3f7f8;
  box-shadow: none;
}

.hero {
  padding: 4.25rem 0 2.5rem;
}

.hero h1 {
  margin: 0;
  font-family: "Merriweather", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.14;
  max-width: 16ch;
}

.hero p {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 62ch;
  margin: 1rem 0 0;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

.search-box {
  margin-top: 2.2rem;
}

.search-box form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.input,
.editor-field {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font-family: inherit;
  font-size: 0.98rem;
  background: #fff;
}

.input:focus,
.editor-field:focus {
  border-color: rgba(15, 118, 110, 0.6);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  margin: 1rem 0 3.2rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: riseIn 420ms ease both;
}

.card-media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(120deg, rgba(15, 118, 110, 0.2), rgba(249, 115, 22, 0.35));
  display: flex;
  align-items: flex-end;
  padding: 0.65rem;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.card-body {
  padding: 1rem 1rem 1.1rem;
}

.meta {
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.card h2,
.card h3 {
  margin: 0.2rem 0 0.6rem;
  font-size: 1.22rem;
  line-height: 1.3;
  font-family: "Merriweather", Georgia, serif;
}

.card p {
  margin: 0;
  color: #2b363c;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  padding: 1.2rem;
  margin: 1rem 0 3rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  padding: 2.4rem 0 4.4rem;
}

.article {
  max-width: 780px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: min(4vw, 2rem);
}

.article h1 {
  font-family: "Merriweather", Georgia, serif;
  line-height: 1.2;
  margin: 0.4rem 0 0.8rem;
}

.article .post-body {
  margin-top: 1.2rem;
  color: #253039;
}

.article .post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.article .post-body pre,
.article .post-body code {
  font-family: "IBM Plex Mono", Consolas, monospace;
}

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

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.panel {
  width: min(820px, 96vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: min(4vw, 1.8rem);
}

.panel.narrow {
  width: min(520px, 94vw);
}

.panel h1 {
  font-family: "Merriweather", Georgia, serif;
  margin: 0;
}

.muted {
  color: var(--muted);
}

.form-row {
  margin-top: 1rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.flash {
  margin-top: 0.9rem;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-size: 0.96rem;
}

.flash.error {
  background: #fff1f1;
  color: #8f2020;
  border: 1px solid #f4c8c8;
}

.flash.success {
  background: #edf9f2;
  color: #14532d;
  border: 1px solid #bddcc7;
}

.flash.info {
  background: #eef7fc;
  color: #124265;
  border: 1px solid #bfdaf0;
}

.table-wrap {
  margin-top: 1.2rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}

th,
td {
  text-align: left;
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: #f4f8f9;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.row-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.inline {
  display: inline;
}

.textarea-input {
  width: min(900px, 100%);
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font-family: inherit;
  font-size: 0.98rem;
  background: #fff;
  resize: vertical;
}

.textarea-input:focus {
  border-color: rgba(15, 118, 110, 0.6);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.form-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.input.compact {
  width: 100%;
}

.hint {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.2rem;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.8rem;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card .value {
  margin-top: 0.25rem;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eff7f6;
  border: 1px solid #cfe5e3;
  color: #0f5551;
  font-weight: 700;
  padding: 0.2rem 0.62rem;
}

.score-breakdown {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.87rem;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.record-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 0.85rem;
}

.record-item .label {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.record-item .value {
  margin-top: 0.2rem;
  font-weight: 600;
}

.detail-block {
  margin-top: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 0.95rem;
  white-space: pre-wrap;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .hero {
    padding-top: 2.8rem;
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.75rem 0;
  }

  .article-nav {
    flex-direction: column;
  }

  .form-grid-two,
  .record-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
