:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --muted: #5c6570;
  --border: #e2e6eb;
  --accent: #e96300;
  --accent-hover: #c75300;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --max: 1120px;
  --content: 72ch;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-hover); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: .5rem 1rem;
  z-index: 1000;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem 1rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space:nowrap;
}
.logo:hover { color: var(--accent); }

.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .45rem .8rem;
  font-size: .95rem;
  background: var(--bg);
  color: var(--text);
  user-select: none;
}

.site-nav {
  flex: 1 1 auto;
  min-width: 0;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .1rem .7rem;
  align-items: center;
  justify-content: flex-end;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: .25rem 0;
  white-space: nowrap;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--accent); }

.page-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 2rem;
  align-items: start;
}

.layout.single-col { grid-template-columns: 1fr; }

.hero {
  margin-bottom: 1.75rem;
}
.hero h1 {
  margin: 0 0 .4rem;
  font-size: clamp(1.6rem, 2.5vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .55rem;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover {
  border-color: #f0c9a8;
  transform: translateY(-1px);
}
.card h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}
.card h2 a {
  color: var(--text);
  text-decoration: none;
}
.card h2 a:hover { color: var(--accent); }
.card .excerpt {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
  flex: 1;
}
.card .more {
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  margin-top: .25rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  font-size: .85rem;
  color: var(--muted);
}
.meta a {
  color: var(--muted);
  text-decoration: none;
}
.meta a:hover { color: var(--accent); }
.meta .sep::before { content: "·"; margin-right: .75rem; color: #b0b7c0; }

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem 2rem;
  box-shadow: var(--shadow);
}
.article-card > header h1 {
  margin: .4rem 0 1rem;
  font-size: clamp(1.55rem, 2.8vw, 2.15rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.entry {
  max-width: var(--content);
  font-size: 1.05rem;
}
.entry h2 {
  margin: 1.8rem 0 .7rem;
  font-size: 1.35rem;
  line-height: 1.3;
}
.entry h3 {
  margin: 1.4rem 0 .55rem;
  font-size: 1.15rem;
}
.entry p { margin: 0 0 1rem; }
.entry ul, .entry ol { margin: 0 0 1rem; padding-left: 1.35rem; }
.entry li { margin: .3rem 0; }
.entry blockquote {
  margin: 1.25rem 0;
  padding: .85rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: #fff7ef;
  color: #3a3228;
  border-radius: 0 8px 8px 0;
}
.entry blockquote p:last-child { margin-bottom: 0; }
.entry strong { font-weight: 650; }

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}
.entry table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  min-width: 480px;
}
.entry th, .entry td {
  border-bottom: 1px solid var(--border);
  padding: .55rem .7rem;
  text-align: left;
  vertical-align: top;
}
.entry th {
  background: #fafbfc;
  font-weight: 650;
}

.tags {
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: .92rem;
  color: var(--muted);
}
.tags a {
  display: inline-block;
  margin: .2rem .25rem .2rem 0;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-size: .85rem;
}
.tags a:hover {
  border-color: #f0c9a8;
  color: var(--accent);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
.post-nav a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  text-decoration: none;
  color: var(--text);
  font-size: .92rem;
}
.post-nav a:hover { border-color: #f0c9a8; color: var(--accent); }
.post-nav .label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .25rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.post-nav .next { text-align: right; }

.sidebar .widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.sidebar h2 {
  margin: 0 0 .75rem;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar li { margin: 0; }
.sidebar li + li {
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px solid var(--border);
}
.sidebar a {
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  line-height: 1.4;
  display: block;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.sidebar a:hover { color: var(--accent); }
.sidebar .count {
  color: var(--muted);
  font-size: .82rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: center;
  margin: 2rem 0 0;
  list-style: none;
  padding: 0;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  padding: 0 .7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
}
.pagination a:hover { border-color: #f0c9a8; color: var(--accent); }
.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination .disabled { opacity: .45; pointer-events: none; }

.archive-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
}
.archive-title span {
  color: var(--muted);
  font-weight: 500;
  font-size: .95rem;
  display: block;
  margin-top: .25rem;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.cat-grid a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem 1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}
.cat-grid a:hover { border-color: #f0c9a8; color: var(--accent); }
.cat-grid .count { color: var(--muted); font-size: .85rem; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 1rem;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  justify-content: space-between;
  color: var(--muted);
  font-size: .9rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}
.footer-nav a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}

@media (max-width: 720px) {
  .nav-toggle-label { display: inline-flex; align-items: center; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .75rem 1.25rem 1rem;
    box-shadow: var(--shadow);
  }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: .15rem;
  }
  .site-nav a {
    display: block;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border);
  }
  .site-header { position: relative; }
  .header-inner { position: relative; }
  .article-card { padding: 1.25rem 1rem 1.5rem; }
  body { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
}
