/* ═══════════════════════════════════════
   拾光集 — Digital Atelier Theme
   ═══════════════════════════════════════ */

:root {
  --bg: #0c0b0a;
  --surface: #161413;
  --border: #2a2622;
  --text: #ede8df;
  --text-secondary: #8a8279;
  --text-muted: #5a554e;
  --accent: #c8955a;
  --accent-light: #e0b87a;
  --accent-dim: rgba(200, 149, 90, 0.12);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

  --max-width: 720px;
  --max-wide: 960px;
  --nav-height: 72px;
  --section-gap: 6rem;
}

/* ── Reset ── */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  position: relative;
}

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

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

/* ── Grain Overlay ── */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ── Reveal Animation ── */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: reveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Navigation ── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
  background: rgba(12, 11, 10, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background 0.3s ease;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text);
  transition: color 0.3s ease;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  position: relative;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ── Hero ── */

.hero {
  padding-top: calc(var(--nav-height) + 6rem);
  padding-bottom: 4rem;
  padding-left: clamp(1.5rem, 5vw, 3rem);
  padding-right: clamp(1.5rem, 5vw, 3rem);
  max-width: var(--max-wide);
}

.hero-greeting {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 8vw, 6rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 300;
  line-height: 1.9;
  color: var(--text-secondary);
  max-width: 540px;
}

.accent {
  color: var(--accent);
  font-weight: 400;
}

/* ── Content ── */

.content {
  padding: 0 clamp(1.5rem, 5vw, 3rem);
  padding-bottom: var(--section-gap);
}

/* ── Section Header ── */

.section-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
  max-width: var(--max-wide);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Posts List ── */

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: var(--max-wide);
}

.post-card {
  display: block;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.35s ease;
  position: relative;
}

.post-card:first-child {
  border-top: 1px solid var(--border);
}

.post-card:hover {
  padding-left: 1.25rem;
}

.post-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2.5rem;
  bottom: 2.5rem;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.post-card:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.post-meta time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.post-tag {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.15rem 0.6rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.post-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--text);
  transition: color 0.3s ease;
}

.post-card:hover .post-title {
  color: var(--accent-light);
}

.post-excerpt {
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 1rem;
}

.post-read {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.post-read .arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

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

.post-card:hover .post-read .arrow {
  transform: translateX(6px);
}

/* ── About Section ── */

.about-section {
  margin-top: var(--section-gap);
  max-width: var(--max-wide);
}

.about-content p {
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.9;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  max-width: 600px;
}

.about-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
}

.about-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  position: relative;
  padding-bottom: 4px;
  transition: color 0.3s ease;
}

.about-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s ease;
}

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

.about-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ── Footer ── */

.footer {
  padding: 3rem clamp(1.5rem, 5vw, 3rem);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-wide);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.footer-muted a {
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

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

/* ═══════════════════════════════════════
   Article Page Styles
   ═══════════════════════════════════════ */

.article-header {
  padding-top: calc(var(--nav-height) + 5rem);
  padding-bottom: 3rem;
  padding-left: clamp(1.5rem, 5vw, 3rem);
  padding-right: clamp(1.5rem, 5vw, 3rem);
  max-width: var(--max-width);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  transition: color 0.3s ease;
}

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

.back-link .arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

.back-link:hover .arrow {
  transform: translateX(-4px);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.article-meta time {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.reading-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.article-tags {
  display: flex;
  gap: 0.75rem;
}

/* ── Article Content ── */

.article-content {
  padding: 0 clamp(1.5rem, 5vw, 3rem);
  padding-bottom: 5rem;
}

.article-body {
  max-width: var(--max-width);
  font-size: 1.08rem;
  font-weight: 300;
  line-height: 2;
  color: var(--text-secondary);
}

.article-body p {
  margin-bottom: 1.75rem;
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 3.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.3;
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.article-body a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.3s ease;
}

.article-body a:hover {
  border-bottom-color: var(--accent);
}

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

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

.article-body blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.75rem;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 0 4px 4px 0;
}

.article-body blockquote p {
  margin-bottom: 0;
  font-style: italic;
  color: var(--text);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--accent-light);
  background: var(--surface);
  padding: 0.15em 0.45em;
  border-radius: 3px;
}

.article-body pre {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
}

.article-body pre code {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
  background: none;
  padding: 0;
}

.article-body ul,
.article-body ol {
  margin-bottom: 1.75rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body img {
  margin: 2.5rem 0;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ── Article Footer ── */

.article-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem clamp(1.5rem, 5vw, 3rem);
  border-top: 1px solid var(--border);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.article-nav a {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

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

/* ── Responsive ── */

@media (max-width: 640px) {
  :root {
    --section-gap: 4rem;
  }

  body {
    font-size: 16px;
  }

  .hero {
    padding-top: calc(var(--nav-height) + 3.5rem);
    padding-bottom: 2.5rem;
  }

  .hero-title {
    font-size: clamp(2.5rem, 12vw, 4rem);
  }

  .post-title {
    font-size: 1.4rem;
  }

  .post-card {
    padding: 2rem 0;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .about-links {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ── Selection ── */

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ── Scrollbar ── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
