/* =========================================================
   林间书简 · Personal Blog Demo
   Editorial, paper-warm, serif-forward
   ========================================================= */

:root {
  --ink: #1a1814;
  --ink-soft: #3d3a34;
  --muted: #6b6560;
  --faint: #9a938b;
  --paper: #f7f3ec;
  --paper-deep: #efe8dc;
  --card: #fffcf7;
  --line: #e4ddd0;
  --line-strong: #d0c7b6;
  --accent: #8b4518;
  --accent-hover: #6d3410;
  --accent-soft: rgba(139, 69, 24, 0.08);
  --highlight: #c4784a;
  --tag-bg: #ebe4d6;
  --shadow: 0 1px 2px rgba(26, 24, 20, 0.04), 0 8px 24px rgba(26, 24, 20, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --max: 720px;
  --wide: 1080px;
  --nav-h: 64px;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", Georgia, serif;
  --font-sans: "DM Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(196, 120, 74, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(139, 69, 24, 0.06), transparent 45%);
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease);
}

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

a:focus-visible,
button:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Layout shell ---------- */

.site-header,
.site-main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-main {
  flex: 1;
  width: 100%;
  padding-bottom: 4rem;
}

.container {
  width: min(100% - 2.5rem, var(--wide));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2.5rem, var(--max));
}

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 243, 236, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(26, 24, 20, 0.03);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
}

.brand__mark {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand__tag {
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.04em;
  display: none;
}

@media (min-width: 640px) {
  .brand__tag {
    display: inline;
  }
}

.nav-links {
  display: none;
  list-style: none;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.45rem 0.85rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  border-radius: 999px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--accent-soft);
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
}

.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="false"] .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
  .nav-toggle {
    display: none;
  }
}

/* Mobile menu panel */
.mobile-nav {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 0.75rem 0 1rem;
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-nav a {
  display: block;
  padding: 0.75rem 0;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--line);
}

.mobile-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

@media (min-width: 768px) {
  .mobile-nav {
    display: none !important;
  }
}

/* ---------- Hero ---------- */

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

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--highlight);
  margin-bottom: 1.25rem;
}

.hero__eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--highlight);
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 5vw, 3.15rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.01em;
  max-width: 16ch;
  margin-bottom: 1.25rem;
}

.hero__lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 38ch;
  line-height: 1.75;
  margin-bottom: 2rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  font-size: 0.88rem;
  color: var(--faint);
}

.hero__meta strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

/* ---------- Section heads ---------- */

.section {
  padding: 1.5rem 0 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
}

.section-head a {
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
}

.section-head a:hover {
  color: var(--accent);
}

/* ---------- Featured post ---------- */

.featured {
  display: grid;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.featured:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 24, 20, 0.06), 0 16px 40px rgba(26, 24, 20, 0.08);
  color: inherit;
}

.featured__visual {
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(145deg, #2c2419 0%, #5c4030 40%, #8b5a3c 70%, #c4784a 100%);
  position: relative;
  overflow: hidden;
}

.featured__visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 252, 247, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(196, 120, 74, 0.35) 0%, transparent 35%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 18px,
      rgba(255, 252, 247, 0.03) 18px,
      rgba(255, 252, 247, 0.03) 19px
    );
}

.featured__visual-label {
  position: absolute;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 1;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  color: rgba(255, 252, 247, 0.92);
  line-height: 1.3;
  max-width: 12ch;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.featured__body {
  padding: 1.5rem 1.5rem 1.75rem;
}

@media (min-width: 800px) {
  .featured {
    grid-template-columns: 1.05fr 1fr;
  }
  .featured__visual {
    aspect-ratio: auto;
    min-height: 100%;
  }
  .featured__body {
    padding: 2rem 2rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

.featured__kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--highlight);
  margin-bottom: 0.75rem;
}

.featured h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 0.85rem;
}

.featured p {
  color: var(--muted);
  font-size: 0.98rem;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--faint);
}

.post-meta time::after {
  content: "·";
  margin-left: 1rem;
  color: var(--line-strong);
}

/* ---------- Post list ---------- */

.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.post-card {
  border-bottom: 1px solid var(--line);
}

.post-card a {
  display: grid;
  gap: 0.65rem 1.5rem;
  padding: 1.5rem 0.25rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s var(--ease);
  border-radius: var(--radius-sm);
}

.post-card a:hover {
  background: var(--accent-soft);
  color: inherit;
}

@media (min-width: 640px) {
  .post-card a {
    grid-template-columns: 7rem 1fr auto;
    align-items: baseline;
    padding: 1.6rem 0.75rem;
  }
}

.post-card__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
  letter-spacing: 0.02em;
}

.post-card__title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

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

.post-card__excerpt {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__tags {
  display: none;
}

@media (min-width: 640px) {
  .post-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-end;
  }
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--tag-bg);
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ---------- Page header (inner) ---------- */

.page-header {
  padding: 2.75rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.page-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 0.65rem;
}

.page-header p {
  color: var(--muted);
  max-width: 42ch;
}

/* ---------- Article page ---------- */

.article-header {
  padding: 2.5rem 0 1.75rem;
}

.article-header .breadcrumb {
  font-size: 0.82rem;
  color: var(--faint);
  margin-bottom: 1.25rem;
}

.article-header .breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.article-header .breadcrumb a:hover {
  color: var(--accent);
}

.article-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 4.5vw, 2.65rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.article-header .lead {
  font-size: 1.08rem;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 1.5rem;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink-soft);
}

.article-body > * + * {
  margin-top: 1.35rem;
}

.article-body h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
  line-height: 1.35;
}

.article-body h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2rem;
}

.article-body p {
  max-width: 65ch;
}

.article-body blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--highlight);
  background: var(--paper-deep);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-serif);
  font-size: 1.12rem;
  color: var(--ink);
  line-height: 1.7;
}

.article-body blockquote p {
  margin: 0;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35rem;
  max-width: 60ch;
}

.article-body li + li {
  margin-top: 0.4rem;
}

.article-body em {
  font-style: italic;
}

.article-body strong {
  color: var(--ink);
  font-weight: 600;
}

.article-footer {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.article-footer .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.back-link {
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--muted);
}

.back-link:hover {
  color: var(--accent);
}

/* ---------- About page ---------- */

.about-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 800px) {
  .about-grid {
    grid-template-columns: 220px 1fr;
    gap: 3.5rem;
    align-items: start;
  }
}

.about-portrait {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, #3d3226 0%, #6b4c35 45%, #a0673d 100%);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.about-portrait::after {
  content: "林";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 5rem;
  color: rgba(255, 252, 247, 0.2);
  font-weight: 700;
}

.about-portrait__caption {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--faint);
  text-align: center;
}

.about-content h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--ink);
  margin-bottom: 0.85rem;
  margin-top: 2rem;
}

.about-content h2:first-child {
  margin-top: 0;
}

.about-content p + p {
  margin-top: 1rem;
}

.about-content p {
  color: var(--ink-soft);
  max-width: 55ch;
}

.interest-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.interest-list li {
  padding: 0.4rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* ---------- Filter bar (posts page) ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.filter-btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.post-card.is-hidden {
  display: none;
}

/* ---------- Newsletter / CTA strip ---------- */

.cta-strip {
  margin-top: 3.5rem;
  padding: 2rem 1.75rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: calc(var(--radius) + 4px);
  display: grid;
  gap: 1rem;
}

@media (min-width: 700px) {
  .cta-strip {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 2.25rem 2.5rem;
  }
}

.cta-strip h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--paper);
}

.cta-strip p {
  font-size: 0.92rem;
  color: rgba(247, 243, 236, 0.7);
  max-width: 36ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.35rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--light {
  background: var(--paper);
  color: var(--ink);
}

.btn--light:hover {
  background: #fff;
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 2rem;
  margin-top: auto;
  background: var(--paper-deep);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.footer-note {
  font-size: 0.85rem;
  color: var(--faint);
  max-width: 28ch;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  list-style: none;
}

.footer-links a {
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-copy {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

.demo-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- Utilities ---------- */

.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;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .featured:hover,
  .btn:hover {
    transform: none;
  }
}
