/* =====================================================================
   Karich Blog — Public site styles
   ===================================================================== */

:root {
  --primary: #4f46e5;
  --accent: #ec4899;
  --bg: #ffffff;
  --bg-alt: #f8f9fc;
  --text: #1e2130;
  --text-muted: #6b7280;
  --border: #e9eaf2;
  --card-bg: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow-soft: 0 10px 30px -12px rgba(30, 33, 48, 0.15);
  --shadow-hover: 0 20px 40px -14px rgba(30, 33, 48, 0.25);
}

[data-bs-theme="dark"] {
  --bg: #0f1220;
  --bg-alt: #161a2c;
  --text: #edeef6;
  --text-muted: #9aa0b4;
  --border: #262b42;
  --card-bg: #1a1e33;
  --nav-bg: rgba(15, 18, 32, 0.85);
  --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 20px 40px -14px rgba(0, 0, 0, 0.6);
}

* { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .25s ease, color .25s ease;
}

body.lang-zh { font-family: 'Noto Sans TC', 'Inter', system-ui, sans-serif; }

main { padding-top: 76px; }

a { color: var(--primary); }

.text-muted-soft { color: var(--text-muted) !important; }
.text-primary-soft { color: var(--primary) !important; }

/* ---------- Navbar ---------- */
.site-navbar {
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: box-shadow .25s ease, border-color .25s ease;
  padding: .65rem 0;
}
.site-navbar.scrolled { box-shadow: var(--shadow-soft); border-color: var(--border); }
.navbar-brand { font-weight: 800; font-size: 1.15rem; color: var(--text) !important; display: flex; align-items: center; gap: .5rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.nav-link { color: var(--text) !important; font-weight: 500; padding: .5rem .9rem !important; border-radius: 999px; }
.nav-link.active, .nav-link:hover { color: var(--primary) !important; background: color-mix(in srgb, var(--primary) 10%, transparent); }

.btn-lang, .btn-theme, .btn-account { border: 1px solid var(--border); background: var(--card-bg); color: var(--text); border-radius: 999px; }
.btn-outline-primary-soft { border: 1.5px solid var(--primary); color: var(--primary); border-radius: 999px; font-weight: 600; }
.btn-outline-primary-soft:hover { background: var(--primary); color: #fff; }

/* ---------- Buttons ---------- */
.btn-primary-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-weight: 600; border: none; transition: transform .2s ease, box-shadow .2s ease;
}
.btn-primary-gradient:hover { transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow-hover); color: #fff; }
.btn-link-soft { color: var(--text); font-weight: 600; }
.btn-link-soft:hover { color: var(--primary); }

/* ---------- Hero ---------- */
.hero-section { position: relative; overflow: hidden; padding: 5rem 0 4rem; }
.hero-blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35; z-index: 0; }
.hero-blob-1 { width: 380px; height: 380px; background: var(--primary); top: -100px; right: -80px; }
.hero-blob-2 { width: 320px; height: 320px; background: var(--accent); bottom: -120px; left: -60px; }
.hero-eyebrow { color: var(--primary); font-weight: 700; letter-spacing: .04em; margin-bottom: .4rem; }
.hero-name { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; line-height: 1.1; margin-bottom: .5rem; }
.hero-title { font-size: 1.25rem; color: var(--text-muted); }
.hero-avatar-wrap { width: 260px; height: 260px; position: relative; }
.hero-avatar {
  width: 100%; height: 100%; object-fit: cover; border-radius: 32px;
  border: 6px solid var(--card-bg); box-shadow: var(--shadow-hover);
  transition: transform .35s ease;
}
.hero-avatar:hover { transform: scale(1.03) rotate(-1deg); }
.hero-avatar-placeholder { display: flex; align-items: center; justify-content: center; background: var(--bg-alt); font-size: 5rem; color: var(--text-muted); }

/* ---------- Sections ---------- */
.section-block { padding: 4rem 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  font-weight: 800; font-size: 1.9rem; margin-bottom: 2rem; display: inline-block; position: relative; padding-bottom: .6rem;
}
.section-title::after {
  content: ''; position: absolute; left: 0; bottom: 0; width: 64px; height: 5px; border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
}
.link-view-all { font-weight: 600; color: var(--primary); text-decoration: none; }
.link-view-all:hover { text-decoration: underline; }

.about-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 2.2rem; box-shadow: var(--shadow-soft);
}
.about-text { font-size: 1.08rem; line-height: 1.8; }

/* ---------- Skills ---------- */
.skill-bar { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.skill-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 1s ease; }

/* ---------- Cards (tilt effect) ---------- */
.tilt-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-soft); transition: transform .3s ease, box-shadow .3s ease;
  position: relative;
}
.tilt-card:hover { transform: translateY(-8px) rotate(-0.4deg); box-shadow: var(--shadow-hover); }
.badge-private {
  position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(0,0,0,.65); color: #fff;
  font-size: .72rem; padding: .3rem .6rem; border-radius: 999px;
}
.project-card-image, .post-card-image { aspect-ratio: 16/10; overflow: hidden; background: var(--bg-alt); }
.project-card-image img, .post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.tilt-card:hover img { transform: scale(1.06); }
.placeholder-image { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: var(--text-muted); height: 100%; }
.project-card-body, .post-card-body { padding: 1.25rem 1.4rem 1.4rem; }
.project-card-title, .post-card-title { font-weight: 700; color: var(--text); }
.project-card-desc, .post-card-desc { color: var(--text-muted); font-size: .92rem; }
.tech-chip { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .6rem; font-size: .74rem; color: var(--text-muted); }
.project-link { font-size: .85rem; font-weight: 600; text-decoration: none; }

/* ---------- Timeline (experience) ---------- */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 3px; background: linear-gradient(var(--primary), var(--accent)); border-radius: 3px; }
.timeline-item { position: relative; margin-bottom: 1.8rem; }
.timeline-dot { position: absolute; left: -2rem; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--card-bg); border: 4px solid var(--primary); }
.timeline-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.3rem 1.5rem; box-shadow: var(--shadow-soft); }
.badge-current { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-radius: 999px; padding: .25rem .7rem; font-size: .75rem; font-weight: 600; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(79,70,229,.5); } 70% { box-shadow: 0 0 0 8px rgba(79,70,229,0); } 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0); } }

/* ---------- Resume ---------- */
.resume-card { display: flex; align-items: center; gap: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.1rem 1.3rem; box-shadow: var(--shadow-soft); }
.resume-icon { font-size: 1.8rem; color: var(--primary); }

/* ---------- Locked hint ---------- */
.locked-hint { background: var(--bg-alt); border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 1rem 1.4rem; text-align: center; color: var(--text-muted); }

/* ---------- Auth pages ---------- */
.auth-section { padding: 6rem 0; min-height: 70vh; display: flex; align-items: center; }
.auth-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.4rem; box-shadow: var(--shadow-soft); }
.auth-title { font-weight: 800; margin-bottom: 1.5rem; }
.alert-danger-soft { background: #fee2e2; color: #991b1b; border: none; border-radius: var(--radius-md); padding: .8rem 1rem; }
.alert-success-soft { background: #dcfce7; color: #166534; border: none; border-radius: var(--radius-md); padding: .8rem 1rem; }
.alert-warning-soft { background: #fef3c7; color: #92400e; border: none; border-radius: var(--radius-md); padding: .8rem 1rem; }
[data-bs-theme="dark"] .alert-danger-soft { background: #3f1d1d; color: #fca5a5; }
[data-bs-theme="dark"] .alert-success-soft { background: #1a3a2a; color: #86efac; }
[data-bs-theme="dark"] .alert-warning-soft { background: #3a2e12; color: #fcd34d; }

/* ---------- Contact ---------- */
.contact-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.4rem; box-shadow: var(--shadow-soft); }
.form-control, .form-select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 20%, transparent); background: var(--bg); color: var(--text); }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding: 3.5rem 0 1.5rem; text-align: center; }
.page-hero h1 { font-weight: 800; font-size: 2.1rem; }
.page-hero-desc { color: var(--text-muted); max-width: 640px; margin: .6rem auto 0; }

/* ---------- Post content ---------- */
.post-content { line-height: 1.9; font-size: 1.05rem; }
.post-content img { max-width: 100%; border-radius: var(--radius-md); }

/* ---------- Định dạng do trình soạn thảo (v3.0) tạo ra — áp dụng lại ở
   trang công khai vì nội dung được lưu kèm class (vd class="ql-size-large"),
   không phải chỉ nằm trong khung soạn thảo. ---------- */
.post-content .ql-size-small { font-size: .75em; }
.post-content .ql-size-large { font-size: 1.5em; }
.post-content .ql-size-huge { font-size: 2.5em; }
.post-content .ql-font-arial { font-family: Arial, Helvetica, sans-serif; }
.post-content .ql-font-georgia { font-family: Georgia, 'Times New Roman', serif; }
.post-content .ql-font-times-new-roman { font-family: 'Times New Roman', Times, serif; }
.post-content .ql-font-courier-new { font-family: 'Courier New', Courier, monospace; }
.post-content .ql-font-verdana { font-family: Verdana, Geneva, sans-serif; }
.post-content .ql-align-center { text-align: center; }
.post-content .ql-align-right { text-align: right; }
.post-content .ql-align-justify { text-align: justify; }
.post-content .ql-indent-1 { padding-left: 2em; }
.post-content .ql-indent-2 { padding-left: 4em; }
.post-content .ql-indent-3 { padding-left: 6em; }
.post-content blockquote { border-left: 4px solid var(--primary); margin: 1.2rem 0; padding: .3rem 1.2rem; color: var(--text-muted); font-style: italic; }
.post-content iframe.ql-video, .post-content video { display: block; width: 100%; max-width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius-md); margin: 1rem 0; }
.post-content video { aspect-ratio: auto; background: #000; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 3.5rem 0 1rem; margin-top: 2rem; }
.footer-brand { font-weight: 800; }
.footer-heading { font-weight: 700; margin-bottom: .8rem; font-size: .95rem; }
.footer-links li { margin-bottom: .45rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: .92rem; }
.footer-links a:hover { color: var(--primary); }
.footer-divider { border-color: var(--border); margin: 2rem 0 1rem; }
.social-links a {
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text); transition: all .2s ease;
}
.social-links a:hover { background: var(--primary); color: #fff; transform: translateY(-3px); }
.social-links-static {
  display: inline-flex; align-items: center; height: 38px; padding: 0 .7rem; border-radius: 999px;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text); font-size: .85rem;
}
.footer-qr {
  display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text-muted);
  font-size: .85rem; margin-top: .3rem;
}
.footer-qr img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.footer-qr:hover { color: var(--primary); }

/* ---------- Pagination ---------- */
.page-link { color: var(--primary); border-radius: 8px !important; margin: 0 3px; border-color: var(--border); background: var(--card-bg); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

@media (max-width: 991px) {
  .hero-avatar-wrap { width: 200px; height: 200px; margin-top: 2rem; }
}
