/* ═══════════════════════════════════════
   H.Yin Blog — Design System
   ═══════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg-primary: #FAFAF8;
  --bg-secondary: #F3F1EE;
  --bg-card: #FFFFFF;
  --bg-sidebar: #F7F6F3;
  --bg-tag: #EBE8E3;
  --text-primary: #111;
  --text-secondary: #444;
  --text-muted: #999;
  --accent: #7B9E87;
  --accent-hover: #5C7E68;
  --accent-light: #E8F0EB;
  --border: #E0DDD8;
  --border-light: #EDEBE7;
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'Source Sans 3', 'Segoe UI', sans-serif;
  --max-width: 1400px;
  --radius: 6px;
  --radius-lg: 10px;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent-light); color: #111; }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp .5s ease forwards; opacity: 0; }
.delay-1 { animation-delay: .07s; }
.delay-2 { animation-delay: .14s; }
.delay-3 { animation-delay: .21s; }
.delay-4 { animation-delay: .28s; }
.delay-5 { animation-delay: .35s; }

/* ═══ NAVIGATION ═══ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: all .3s ease;
}
.nav.scrolled {
  background: rgba(250,250,248,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}
.nav-inner {
  max-width: var(--max-width); margin: 0 auto;
  padding: 0 40px; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-serif); font-size: 1.6rem;
  font-weight: 700; color: #111; text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 44px; align-items: center; }
.nav-links a {
  font-family: var(--font-sans); font-size: 1.05rem;
  font-weight: 500; color: #555; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 6px 0;
  border-bottom: 2.5px solid transparent; transition: all .2s;
}
.nav-links a:hover { color: #111; }
.nav-links a.active { font-weight: 700; color: #111; border-bottom-color: #111; }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; color: #111; font-size: 1.5rem; }
.mobile-menu { display: none; background: var(--bg-primary); border-bottom: 1px solid var(--border); padding: 12px 40px 20px; }
.mobile-menu a {
  display: block; padding: 12px 0; font-size: 1.1rem; color: #555;
  border-bottom: 1px solid var(--border-light);
}
.mobile-menu a.active { font-weight: 700; color: #111; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; }
  .mobile-menu.open { display: block; }
  .nav-inner { padding: 0 20px; }
}

/* ═══ LAYOUT ═══ */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 40px; }
.page-content { padding-top: 100px; padding-bottom: 60px; min-height: 100vh; position: relative; z-index: 1; }

.two-col { display: flex; gap: 3%; flex-wrap: wrap; }
.col-main { flex: 1 1 65%; min-width: 360px; }
.col-side { flex: 0 0 28%; min-width: 280px; }

@media (max-width: 768px) {
  .container { padding: 0 20px; }
  .page-content { padding-top: 80px; }
  .col-main, .col-side { flex: 1 1 100%; min-width: 0; }
  .col-side { margin-top: 40px; }
}

/* ═══ HERO ═══ */
.hero {
  padding: 130px 40px 80px; text-align: center;
}
.hero-inner { max-width: 800px; margin: 0 auto; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  font-weight: 700; line-height: 1.3;
  margin-bottom: 20px; color: #111; letter-spacing: -0.02em;
}
.hero p {
  font-size: 1.35rem; color: #555;
  line-height: 1.8; margin-bottom: 40px;
}
.hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-block; padding: 14px 36px;
  font-family: var(--font-sans); font-weight: 600;
  font-size: 1.05rem; border-radius: var(--radius);
  cursor: pointer; transition: all .2s; text-decoration: none;
  border: none;
}
.btn-primary { background: #111; color: #fff; }
.btn-primary:hover { background: #333; color: #fff; }
.btn-outline { background: transparent; color: #111; border: 2px solid #111; }
.btn-outline:hover { background: #111; color: #fff; }
.btn-sm { padding: 8px 20px; font-size: 0.9rem; }

/* ═══ SECTION HEADINGS ═══ */
.section-title {
  font-family: var(--font-serif); font-size: 2rem;
  font-weight: 600; margin-bottom: 36px; color: #111;
}
.page-title {
  font-family: var(--font-serif); font-size: 2.5rem;
  font-weight: 700; margin-bottom: 8px; color: #111;
}
.page-desc {
  font-size: 1.15rem; color: #555; margin-bottom: 32px;
}

/* ═══ CATEGORY FILTERS ═══ */
.cat-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.cat-btn {
  padding: 8px 20px; border-radius: 24px; font-family: var(--font-sans);
  font-size: 0.92rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--bg-card); color: #555;
  transition: all .2s; text-decoration: none;
}
.cat-btn:hover { border-color: #111; color: #111; }
.cat-btn.active { background: #111; color: #fff; border-color: #111; }

/* ═══ ARTICLE CARDS ═══ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
}
@media (max-width: 500px) {
  .card-grid { grid-template-columns: 1fr; }
}
.card-list { display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border-light); padding: 32px;
  transition: box-shadow .25s, transform .25s; text-decoration: none;
  display: block; color: inherit;
}
.card:hover {
  box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit;
}
.card-cat {
  display: inline-block; padding: 4px 12px;
  background: var(--bg-tag); color: #333; border-radius: 14px;
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 14px;
}
.card h3 {
  font-family: var(--font-serif); font-size: 1.6rem;
  font-weight: 600; line-height: 1.3; margin-bottom: 10px; color: #111;
}
.card p {
  font-size: 0.92rem; color: #555; line-height: 1.8; margin-bottom: 16px;
}
.card-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.8rem; color: #999;
}
.card-meta span { display: flex; align-items: center; gap: 4px; }

/* ═══ SIDEBAR ═══ */
.sidebar { position: sticky; top: 92px; }
.sidebar-block {
  padding: 20px; background: var(--bg-sidebar);
  border-radius: var(--radius-lg); border: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.sidebar-block h4 {
  font-family: var(--font-serif); font-weight: 600;
  font-size: 1rem; margin-bottom: 8px; color: #111;
}
.sidebar-block p { font-size: 0.92rem; color: #555; line-height: 1.8; }

.search-box {
  position: relative; margin-bottom: 20px;
}
.search-box input {
  width: 100%; padding: 12px 14px 12px 42px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); font-size: 0.92rem; color: #111;
  outline: none; font-family: var(--font-sans);
}
.search-box input:focus { border-color: #111; }
.search-box svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #999; pointer-events: none;
}

/* ── Newsletter (sidebar) ── */
.newsletter {
  padding: 20px; background: var(--bg-sidebar);
  border-radius: var(--radius-lg); border: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.newsletter h4 {
  font-family: var(--font-serif); font-weight: 600; margin-bottom: 6px; color: #111;
}
.newsletter p { font-size: 0.92rem; color: #555; margin-bottom: 14px; }
.newsletter-form { display: flex; gap: 8px; }
.newsletter-form input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-card);
  font-size: 0.92rem; color: #111; outline: none; font-family: var(--font-sans);
}
.newsletter-form button {
  padding: 10px 18px; background: #111; color: #fff; border: none;
  border-radius: var(--radius); cursor: pointer; font-weight: 600;
  font-size: 0.92rem; white-space: nowrap;
}
.newsletter-form button:hover { background: #333; }

/* ═══ SINGLE POST ═══ */
.post-header { margin-bottom: 36px; padding-bottom: 24px; border-bottom: 1px solid var(--border-light); }
.post-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 700; line-height: 1.3; margin-bottom: 16px; color: #111;
}
.post-meta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 0.8rem; color: #999;
}
.post-meta span { display: flex; align-items: center; gap: 4px; }

.post-body {
  font-family: var(--font-serif); font-size: 1.15rem;
  line-height: 1.8; color: #222;
}
.post-body h2 { font-family: var(--font-sans); font-size: 1.6rem; font-weight: 700; color: #111; margin: 40px 0 16px; }
.post-body h3 { font-family: var(--font-sans); font-size: 1.3rem; font-weight: 600; color: #111; margin: 32px 0 12px; }
.post-body p { margin-bottom: 24px; }
.post-body ul, .post-body ol { margin-bottom: 24px; padding-left: 28px; }
.post-body li { margin-bottom: 8px; }
.post-body blockquote {
  border-left: 4px solid #111; padding: 16px 24px; margin: 24px 0;
  background: var(--bg-tag); border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic; color: #555;
}
.post-body code {
  background: var(--bg-tag); padding: 2px 6px; border-radius: 3px;
  font-size: 0.9em;
}
.post-body pre {
  background: #1a1a1a; color: #e0e0e0; padding: 20px 24px;
  border-radius: var(--radius); overflow-x: auto;
  margin-bottom: 24px; font-size: 0.9rem; line-height: 1.6;
}
.post-body pre code { background: none; padding: 0; color: inherit; }
.post-body img {
  border-radius: var(--radius); margin: 24px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-light); }
.post-tags a, .post-tags span {
  padding: 4px 12px; background: var(--bg-tag); border-radius: 14px;
  font-size: 0.8rem; font-family: var(--font-sans); color: #555;
  text-decoration: none;
}

/* ── Author Bio ── */
.author-bio {
  display: flex; gap: 20px; align-items: flex-start; padding: 28px;
  background: var(--bg-sidebar); border-radius: var(--radius-lg);
  border: 1px solid var(--border-light); margin-top: 40px;
}
.author-avatar {
  width: 68px; height: 68px; border-radius: 50%;
  background: linear-gradient(135deg, #ddd, #999);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: white; font-family: var(--font-serif); font-size: 1.6rem; font-weight: 700;
}
.author-bio h4 { font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; margin-bottom: 4px; color: #111; }
.author-bio p { font-size: 0.92rem; color: #555; line-height: 1.8; }

/* ── Social Share ── */
.share { display: flex; align-items: center; gap: 12px; margin: 32px 0; padding-top: 24px; border-top: 1px solid var(--border-light); }
.share-label { font-size: 0.92rem; color: #999; font-weight: 500; }
.share-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-card);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: #888; transition: all .2s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ═══ CONTACT PAGE ═══ */
.contact-header {
  background: #111; border-radius: var(--radius-lg); padding: 56px 48px;
  color: white; margin-bottom: 48px; position: relative; overflow: hidden;
}
.contact-header::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.contact-header h1 {
  font-family: var(--font-sans); font-size: 2.5rem;
  font-weight: 700; color: #fff; position: relative;
}
.contact-header h1 span { opacity: 0.5; font-weight: 400; }
.contact-header p {
  font-family: var(--font-serif); font-style: italic;
  color: rgba(255,255,255,0.7); margin-top: 12px;
  font-size: 1.05rem; line-height: 1.6; position: relative;
}

.contact-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; margin-bottom: 48px;
}
.contact-item {
  padding: 28px; background: var(--bg-card);
  border-radius: var(--radius-lg); border: 1px solid var(--border-light);
  display: flex; align-items: flex-start; gap: 16px;
  transition: box-shadow .2s;
}
.contact-item:hover { box-shadow: var(--shadow-md); }
.contact-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--bg-tag); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; font-size: 1.2rem;
}
.contact-item h3 {
  font-family: var(--font-sans); font-size: 0.85rem;
  font-weight: 600; color: #999; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 4px;
}
.contact-item p {
  font-size: 1.05rem; color: #111; font-weight: 500; word-break: break-all;
}
.contact-item a { color: #111; }
.contact-item a:hover { color: var(--accent); }

/* ═══ SOFTWARE PAGE ═══ */
.software-card {
  padding: 36px; background: var(--bg-card);
  border-radius: var(--radius-lg); border: 1px solid var(--border-light);
  margin-bottom: 24px; transition: box-shadow .25s;
}
.software-card:hover { box-shadow: var(--shadow-md); }
.software-card h3 {
  font-family: var(--font-sans); font-size: 1.5rem;
  font-weight: 700; color: #111; margin-bottom: 12px;
}
.software-card p {
  font-size: 1rem; color: #555; line-height: 1.8; margin-bottom: 20px;
}
.software-card .tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.software-card .tag {
  padding: 4px 12px; background: var(--bg-tag); border-radius: 14px;
  font-size: 0.8rem; color: #555;
}

/* ═══ SECTION HEADER ═══ */
.sec-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.sec-header-icon {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--bg-tag); display: flex; align-items: center;
  justify-content: center; color: #555; font-size: 1.1rem;
}
.sec-header h2 {
  font-family: var(--font-sans); font-size: 1.6rem;
  font-weight: 700; color: #111;
}

/* ═══ EDUCATION (Contact page) ═══ */
.edu-card {
  padding: 28px; background: var(--bg-card);
  border-radius: var(--radius-lg); border: 1px solid var(--border-light);
  margin-bottom: 16px;
}
.edu-card h3 { font-size: 1.15rem; font-weight: 700; color: #111; }
.edu-card .period { font-size: 0.92rem; color: #999; }
.edu-card .school { font-size: 0.92rem; color: #333; font-weight: 600; margin: 6px 0 8px; }
.edu-card .school span { color: #999; font-weight: 400; }
.edu-card .courses { font-size: 0.92rem; color: #555; line-height: 1.6; }

/* ── Publications ── */
.pub-item {
  padding: 18px 24px 18px 30px; background: var(--bg-card);
  border-radius: var(--radius); border: 1px solid var(--border-light);
  margin-bottom: 12px; position: relative;
}
.pub-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; border-radius: var(--radius) 0 0 var(--radius);
  background: #111;
}
.pub-item.q3::before { background: #ccc; }
.pub-item p { font-size: 0.92rem; line-height: 1.8; color: #222; }
.pub-item strong { font-weight: 600; }
.pub-item em { color: #555; }
.pub-rank {
  display: inline-block; margin-top: 6px; padding: 2px 10px;
  border-radius: 8px; font-size: 0.8rem; font-weight: 600;
}
.pub-rank.q1 { background: #111; color: #fff; }
.pub-rank.q3 { background: var(--bg-tag); color: #777; }

/* ═══ COMMENTS ═══ */
.comments { margin-top: 40px; }
.comments h3 {
  font-family: var(--font-serif); font-size: 1.35rem;
  font-weight: 600; margin-bottom: 20px; color: #111;
}
.comment-item {
  padding: 20px; background: var(--bg-sidebar);
  border-radius: var(--radius); margin-bottom: 12px;
  border: 1px solid var(--border-light);
}
.comment-form textarea {
  width: 100%; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-card);
  font-size: 0.92rem; font-family: var(--font-sans); color: #111;
  resize: vertical; outline: none;
}
.comment-form textarea:focus { border-color: #111; }

/* ═══ FOOTER ═══ */
.footer {
  border-top: 1px solid var(--border-light); padding: 36px 40px;
  text-align: center; background: var(--bg-secondary);
}
.footer p { font-size: 0.92rem; color: #999; }

/* ═══ BACK LINK ═══ */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.92rem; color: #555; margin-bottom: 28px;
  transition: color .2s;
}
.back-link:hover { color: #111; }

/* ═══ FLOATING CHARACTERS ═══ */
.floating-chars {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.floating-char {
  position: absolute; opacity: 0.12; filter: grayscale(20%);
  will-change: transform;
}
