:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #657080;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warm: #b45309;
  --blue: #2563eb;
  font-family: "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  font-weight: 800;
  letter-spacing: 0;
}

nav {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

nav a.active,
nav a:hover {
  color: var(--accent-dark);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.toolbar,
.featured,
.admin-shell,
.post-detail,
.empty-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-bottom: 18px;
}

.search {
  display: flex;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

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

.category-row a,
.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.category-row a.selected {
  color: #fff;
  background: var(--text);
  border-color: var(--text);
}

.featured {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) 1.1fr;
  gap: 26px;
  align-items: center;
  padding: 18px;
  margin-bottom: 18px;
}

.featured h1 {
  margin: 8px 0 12px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.16;
  letter-spacing: 0;
}

.featured p,
.post-card p,
.lead {
  color: var(--muted);
  line-height: 1.7;
}

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

.post-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.post-card-body {
  padding: 16px;
}

.post-card h2 {
  margin: 8px 0;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: 0;
}

.cover,
.featured-cover,
.detail-cover {
  display: block;
  overflow: hidden;
  background: #dfe5e8;
}

.cover {
  aspect-ratio: 16 / 10;
}

.featured-cover,
.detail-cover {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(37, 99, 235, 0.16)),
    repeating-linear-gradient(45deg, #eef2f7 0 12px, #e0e7ef 12px 24px);
  color: var(--accent-dark);
  font-weight: 800;
}

.meta,
.detail-meta {
  color: var(--warm);
  font-size: 13px;
  font-weight: 700;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.post-detail {
  padding: clamp(18px, 4vw, 42px);
}

.post-detail h1 {
  max-width: 880px;
  margin: 16px 0 10px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.18;
  letter-spacing: 0;
}

.detail-tags {
  margin-bottom: 26px;
}

.content {
  max-width: 820px;
  line-height: 1.85;
  font-size: 17px;
}

.content h2,
.content h3 {
  margin-top: 32px;
  line-height: 1.35;
  letter-spacing: 0;
}

.content ul {
  padding-left: 22px;
}

.content figure {
  margin: 28px 0;
}

.content figure img {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  border-radius: 8px;
  background: #f6f8fb;
}

.source-link {
  margin-top: 32px;
  color: var(--blue);
  font-weight: 700;
}

.admin-shell {
  padding: clamp(18px, 4vw, 32px);
}

.admin-head h1 {
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: 0;
}

.admin-head p {
  margin: 0 0 20px;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 20px;
}

.editor {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
}

.api-panel {
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.api-panel h2 {
  margin-top: 0;
}

pre,
.result {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #f1f5f9;
  font-size: 13px;
}

.empty,
.empty-page {
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .featured,
  .post-grid,
  .admin-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .api-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 20px;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .search {
    flex-direction: column;
  }
}
