/* ==========================================================================
   Vahram 的 blog — Minimal Apple Newsroom Design System
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, monospace;

  --bg-feed: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.82);
  --bg-pill-track: rgba(118, 118, 128, 0.12);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --apple-blue: #0066cc;

  --hairline: rgba(0, 0, 0, 0.08);
  --border-card: rgba(0, 0, 0, 0.04);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 980px;

  --container-width: 720px;
  --nav-height: 52px;
}

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

html {
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: var(--bg-feed);
}

body.page-article {
  background-color: var(--bg-surface);
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ==========================================================================
   Sticky Top Bar (Apple Translucent Material)
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background-color: var(--bg-header);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}

.nav-container {
  max-width: var(--container-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: opacity 0.15s ease;
}

.brand-logo:hover {
  opacity: 0.72;
}

/* Apple Segmented Language Control */
.lang-switcher-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-pill-track);
  padding: 2px;
  border-radius: var(--radius-pill);
  user-select: none;
}

.lang-btn {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0.5px 1px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Chronological Feed & 3 Category Filters
   ========================================================================== */

.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 40px 24px 88px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.chip-btn {
  padding: 7px 17px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: -0.008em;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.12);
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.chip-btn:hover {
  background: var(--bg-surface);
  border-color: rgba(0, 0, 0, 0.26);
}

.chip-btn.active {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.posts-timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.story-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.035);
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1),
              box-shadow 0.28s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.story-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
}

.story-card-link {
  display: block;
}

.story-image-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-feed);
}

.story-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.story-card:hover .story-image {
  transform: scale(1.02);
}

.story-content {
  padding: 32px 36px;
}

.story-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.meta-dot {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

.story-date {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.story-title {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.022em;
  color: var(--text-primary);
  margin-bottom: 10px;
  transition: color 0.18s ease;
}

html[lang="zh-CN"] .story-title {
  line-height: 1.34;
  letter-spacing: -0.01em;
}

.story-card:hover .story-title {
  color: var(--apple-blue);
}

.story-excerpt {
  font-size: 1rem;
  line-height: 1.58;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-filter-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.95rem;
}

/* ==========================================================================
   Article Reading View (Apple Newsroom Editorial Column)
   ========================================================================== */

.article-page {
  flex: 1;
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 56px 24px 88px;
}

.article-header {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--hairline);
}

.article-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.article-date {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.article-headline {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.028em;
  color: var(--text-primary);
}

html[lang="zh-CN"] .article-headline {
  font-size: 2.25rem;
  line-height: 1.26;
  letter-spacing: -0.012em;
}

.article-deck {
  margin-top: 16px;
  font-size: 1.3rem;
  line-height: 1.45;
  color: var(--text-secondary);
  font-weight: 400;
}

.article-cover-figure {
  margin: 0 0 36px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-feed);
}

.article-cover-img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
}

/* Editorial Prose */
.article-body {
  font-size: 1.1875rem; /* 19px Apple Newsroom standard */
  line-height: 1.68;
  letter-spacing: -0.011em;
  color: var(--text-primary);
}

html[lang="zh-CN"] .article-body {
  font-size: 1.125rem; /* 18px optimal CJK reading size */
  line-height: 1.85;
  letter-spacing: 0;
}

.article-body p {
  margin-bottom: 1.45em;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.article-body h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.24;
  margin: 2em 0 0.75em;
}

.article-body h3 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.016em;
  line-height: 1.3;
  margin: 1.6em 0 0.6em;
}

.article-body h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.4em 0 0.5em;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.45em 1.4em;
}

.article-body li {
  margin-bottom: 0.45em;
}

.article-body a {
  color: var(--apple-blue);
}

.article-body a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body blockquote {
  margin: 1.8em 0;
  padding-left: 20px;
  border-left: 3px solid var(--text-primary);
  color: var(--text-secondary);
}

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

/* Inline Figures & Images */
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1.8em auto;
}

.article-inline-figure {
  margin: 2.2em 0;
}

.article-inline-figure img {
  width: 100%;
  border-radius: var(--radius-md);
  margin: 0;
}

.figure-caption {
  padding-top: 10px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-tertiary);
}

/* Clean Editorial Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 0.95rem;
}

.article-body th {
  padding: 12px 14px;
  font-weight: 600;
  text-align: left;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.16);
}

.article-body td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-secondary);
}

/* Clean Minimal Code Blocks */
.code-block {
  margin: 1.8em 0;
  background: var(--bg-feed);
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  overflow-x: auto;
}

.code-block pre {
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary);
}

p code, li code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 6px;
  background: var(--bg-feed);
  border-radius: 5px;
  color: var(--text-primary);
}

.article-back-nav {
  margin-top: 52px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
}

.article-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--apple-blue);
  transition: opacity 0.15s ease;
}

.article-back-link:hover {
  opacity: 0.75;
}

/* ==========================================================================
   Minimal Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 28px 0 36px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.footer-container {
  max-width: var(--container-width);
  padding: 0 24px;
  margin: 0 auto;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 640px) {
  .nav-container,
  .footer-container {
    padding: 0 18px;
  }

  .main-content {
    padding: 28px 18px 64px;
  }

  .story-content {
    padding: 24px 22px;
  }

  .story-title {
    font-size: 1.375rem;
  }

  .article-page {
    padding: 40px 20px 72px;
  }

  .article-headline {
    font-size: 2rem;
  }

  html[lang="zh-CN"] .article-headline {
    font-size: 1.85rem;
  }

  .article-body {
    font-size: 1.0625rem;
  }

  html[lang="zh-CN"] .article-body {
    font-size: 1.05rem;
  }
}
