:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #65707d;
  --line: #dfe4e9;
  --nav: #101820;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #e8f5f2;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(16, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.wrap {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: var(--nav);
  color: #fff;
}

.header-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.brand:hover {
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.main-nav a {
  color: #d7e0e8;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.page-shell,
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  padding-top: 28px;
  padding-bottom: 56px;
  align-items: start;
}

.content-column,
.article-content {
  min-width: 0;
}

.intro,
.category-heading,
.article-header,
.sidebar-box {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.intro,
.category-heading {
  padding: 28px 30px;
}

.intro h1,
.category-heading h1,
.article-header h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1.1;
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.intro p,
.category-heading p,
.article-header p {
  color: var(--muted);
  margin: 0;
  max-width: 780px;
}

.post-section {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

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

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: #cbd4dc;
  box-shadow: var(--shadow);
}

.post-card-media {
  aspect-ratio: 16 / 9;
  background: #e9edf1;
  display: block;
  overflow: hidden;
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.post-card:hover .post-card-media img {
  transform: scale(1.03);
}

.post-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.post-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.post-card[data-category="image-editing"] .category-pill {
  background: #dbeafe;
  color: #1d4ed8;
}

.post-card[data-category="pdf-tips"] .category-pill {
  background: #fef3c7;
  color: #92400e;
}

.post-card[data-category="mosaic-diy"] .category-pill {
  background: #fce7f3;
  color: #9d174d;
}

.post-card[data-category="print-sticker"] .category-pill {
  background: #dcfce7;
  color: #166534;
}

.post-card[data-category="tool-troubleshoot"] .category-pill {
  background: #ede9fe;
  color: #5b21b6;
}

.post-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.post-card h2 a {
  color: var(--ink);
}

.post-card h2 a:hover {
  color: var(--accent-dark);
}

.post-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 20px;
}

.sidebar-box {
  padding: 20px;
}

.sidebar-box h2 {
  margin: 0 0 16px;
  font-size: 16px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-nav a {
  color: var(--ink);
  padding: 9px 10px;
  border-radius: 6px;
  background: var(--bg);
  line-height: 1.35;
}

.sidebar-nav a:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
  text-decoration: none;
}

.sidebar-nav a.active {
  color: #fff;
  background: var(--accent);
}

.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 28px;
}

.pagination a,
.pagination span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}

.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  text-decoration: none;
}

.pagination .page-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.empty-state {
  border: 1px dashed var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 28px;
  border-radius: 8px;
}

.button-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.button-link:hover,
button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.article-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
}

.article-header {
  border: 0;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.category-link {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.article-date {
  margin-top: 8px !important;
  font-size: 13px;
}

.markdown-body {
  padding-top: 24px;
  font-size: 17px;
  line-height: 1.75;
  color: #28323c;
}

.markdown-body h2 {
  font-size: 26px;
  line-height: 1.25;
  margin: 34px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.markdown-body h3 {
  font-size: 20px;
  line-height: 1.3;
  margin: 26px 0 10px;
}

.markdown-body p {
  margin: 0 0 18px;
}

.markdown-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 18px 22px;
  padding: 0;
}

.markdown-body li {
  margin: 6px 0;
}

.markdown-body img {
  max-height: 520px;
  width: auto;
  margin: 0 auto;
  border-radius: 6px;
}

.article-figure {
  margin: 22px 0;
  text-align: center;
}

.article-figure img {
  max-height: 560px;
  margin: 0 auto;
}

.article-figure figcaption {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.affiliate-label {
  color: var(--muted);
  font-size: 0.8em;
  margin-left: 3px;
}

.related-section {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.related-section h2 {
  margin: 0 0 12px;
  font-size: 21px;
}

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

.site-footer {
  border-top: 1px solid #23303c;
  background: var(--nav);
  color: #cbd5df;
  padding: 24px 0;
  font-size: 13px;
}

.site-footer p {
  margin: 3px 0;
}

.admin-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 28px;
}

.admin-card.wide {
  width: min(980px, 100%);
}

.admin-card h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.2;
}

.admin-card p {
  color: var(--muted);
}

.admin-card label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
}

.admin-card input[type="password"],
.admin-card input[type="file"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  font: inherit;
}

.admin-card button {
  margin-top: 16px;
  width: 100%;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.admin-header h1 {
  margin-bottom: 6px;
}

.text-button {
  white-space: nowrap;
}

.form-error {
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: var(--danger);
  padding: 10px;
  border-radius: 6px;
}

.form-success {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: #067647;
  padding: 10px;
  border-radius: 6px;
}

.admin-upload {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg);
}

.admin-upload label {
  margin: 0;
  align-self: center;
}

.admin-upload input[type="file"] {
  flex: 1;
  min-width: 220px;
}

.admin-upload button {
  margin: 0;
  width: auto;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td code {
  display: inline-block;
  max-width: 430px;
  overflow-wrap: anywhere;
}

button.danger {
  background: var(--danger);
  width: auto;
  margin: 0;
  min-height: 34px;
}

button.danger:hover {
  background: #912018;
}

@media (max-width: 980px) {
  .page-shell,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

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

@media (max-width: 720px) {
  .wrap {
    width: min(1160px, calc(100% - 24px));
  }

  .header-inner {
    display: block;
    padding-top: 12px;
    padding-bottom: 0;
  }

  .brand {
    margin-bottom: 10px;
  }

  .main-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-right: -12px;
    padding-right: 12px;
    scrollbar-width: none;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .main-nav a {
    flex: 0 0 auto;
  }

  .page-shell,
  .article-layout {
    padding-top: 20px;
    padding-bottom: 36px;
  }

  .intro,
  .category-heading {
    padding: 22px 18px;
  }

  .intro h1,
  .category-heading h1,
  .article-header h1 {
    font-size: 30px;
  }

  .section-heading h2 {
    font-size: 21px;
  }

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

  .article-content {
    padding: 22px 18px;
  }

  .site-footer {
    padding: 20px 0;
  }
}
