/* ============================================
   Tech Blog - style.css
   Modern, clean, reader-friendly design
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-dark: #1d4ed8;
  --bg: #f8f9fb;
  --bg-card: #ffffff;
  --bg-code: #f1f5f9;
  --bg-header: rgba(255, 255, 255, 0.92);
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 860px;
  --max-width-wide: 1120px;
  --transition: 0.25s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

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

ul,
ol {
  list-style-position: inside;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.logo .dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-links a:hover {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}

.nav-links a.active {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 80px 24px 60px;
  text-align: center;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

.hero-badges {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.hero-badge .dot-green {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

.hero-actions {
  margin-top: 28px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.hero-cta:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ---------- Section ---------- */
.section {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 24px;
}

.section + .section {
  margin-top: 64px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-head h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 4px;
  margin-right: 10px;
  vertical-align: -4px;
}

.section-head a {
  font-size: 0.88rem;
  font-weight: 500;
}

/* ---------- Article Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--accent-light);
}

.card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-code);
}

.card-body {
  padding: 20px 22px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 10px;
  align-self: flex-start;
}

.card-title {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 8px;
  color: var(--text);
}

.card-title a {
  color: inherit;
}

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

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-light);
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Photo Gallery ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.photo-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background: var(--bg-code);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.photo-item:hover img {
  transform: scale(1.06);
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 50%);
  display: flex;
  align-items: flex-end;
  padding: 14px 16px;
  opacity: 0;
  transition: opacity var(--transition);
}

.photo-item:hover .photo-overlay {
  opacity: 1;
}

.photo-overlay span {
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
}

/* ---------- Article Page ---------- */
.article-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 0;
  text-align: center;
}

.article-header .tag {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.article-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.article-header .meta {
  font-size: 0.88rem;
  color: var(--text-light);
  display: flex;
  justify-content: center;
  gap: 20px;
}

.article-cover {
  max-width: var(--max-width);
  margin: 32px auto;
  padding: 0 24px;
}

.article-cover img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.article-body {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 40px 0 16px;
  letter-spacing: -0.3px;
}

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 28px 0 12px;
}

.article-body p {
  margin-bottom: 18px;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  margin: 0 0 18px 4px;
  padding-left: 20px;
  list-style-position: outside;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body ul li::marker {
  color: var(--accent);
}

.article-body ol li::marker {
  color: var(--accent);
  font-weight: 600;
}

.article-body code {
  font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", Consolas,
    monospace;
  font-size: 0.88em;
  background: var(--bg-code);
  color: var(--accent-dark);
  padding: 2px 7px;
  border-radius: 5px;
}

.article-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 20px 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 22px;
  font-size: 0.86rem;
  line-height: 1.65;
  box-shadow: var(--shadow-md);
}

.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.article-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 20px;
  margin: 0 0 22px;
  background: rgba(37, 99, 235, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

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

.article-body img {
  border-radius: var(--radius);
  margin: 0 0 22px;
  box-shadow: var(--shadow-md);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 0.92rem;
}

.article-body th,
.article-body td {
  padding: 10px 16px;
  text-align: left;
  border: 1px solid var(--border);
}

.article-body th {
  background: var(--bg-code);
  font-weight: 600;
}

/* Syntax highlight (simple) */
.tk-key { color: #c084fc; }
.tk-str { color: #86efac; }
.tk-num { color: #fcd34d; }
.tk-com { color: #64748b; font-style: italic; }
.tk-fn  { color: #60a5fa; }

/* ---------- Article Nav ---------- */
.article-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.article-nav a {
  display: flex;
  flex-direction: column;
  padding: 16px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex: 1;
  transition: all var(--transition);
}

.article-nav a:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-sm);
}

.article-nav .nav-label {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.article-nav .nav-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.article-nav .next {
  text-align: right;
}

/* ---------- About Page ---------- */
.about-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.about-hero {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 48px;
}

.about-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.about-hero-info h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.about-hero-info p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.about-section {
  margin-bottom: 40px;
}

.about-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.about-section h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--accent);
  border-radius: 4px;
  margin-right: 10px;
  vertical-align: -3px;
}

.about-section p {
  color: var(--text);
  margin-bottom: 12px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-tag {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text);
  transition: all var(--transition);
}

.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ---------- Photos Page Head ---------- */
.page-head {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 56px 24px 32px;
  text-align: center;
}

.page-head h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.page-head p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto;
}

/* ---------- Lightbox ---------- */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain;
  transition: transform 0.18s ease;
  transform-origin: center center;
  will-change: transform;
}

.lightbox-caption {
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
  padding: 16px 24px 0;
  max-width: 80vw;
  line-height: 1.5;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  line-height: 1;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.footer-wrap {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-light);
}

.footer-wrap a {
  color: var(--text-secondary);
}

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

.footer-social {
  display: flex;
  gap: 18px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .nav-links {
    gap: 0;
  }

  .nav-links a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .article-header h1 {
    font-size: 1.6rem;
  }

  .about-hero {
    flex-direction: column;
    text-align: center;
  }

  .footer-wrap {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .article-nav {
    flex-direction: column;
  }

  .article-nav .next {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .photo-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 48px 20px 40px;
  }
}
