/* VidDrop site CSS — shared base/nav/prose/footer styles
 * Extracted from templates/_base.html for cache + parallel download.
 * Served với Cache-Control: max-age=604800, immutable (static handler).
 */

  /* Reading-optimized base */
  :root {
    --bg: #060912;
    --bg-elev: #0e1422;
    --text: #e5e7eb;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #1f2937;
    --border-soft: #2a2f3a;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
  }
  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.014em;
    line-height: 1.5;
  }
  h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.02em;
    font-weight: 700;
  }

  /* ════════════════════════════════════════════════ */
  /* PROSE — reading optimized */
  /* ════════════════════════════════════════════════ */
  .prose {
    max-width: 720px;
    margin: 0 auto;
    font-size: 18px;
    line-height: 1.75;
    color: var(--text-secondary);
  }
  .prose h1, .prose h2, .prose h3, .prose h4 {
    color: #ffffff;
    font-weight: 800;
    margin: 2em 0 .6em;
    line-height: 1.25;
    letter-spacing: -0.025em;
  }
  .prose h1 { font-size: 2.25em; margin-top: 0; }
  .prose h2 {
    font-size: 1.6em;
    padding-top: .4em;
    margin-top: 2.2em;
    position: relative;
  }
  .prose h2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 36px;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    border-radius: 2px;
  }
  .prose h3 {
    font-size: 1.3em;
    color: #f3f4f6;
  }
  .prose h4 {
    font-size: 1.1em;
    color: #e5e7eb;
  }
  .prose p {
    margin: 1.25em 0;
    color: #cbd5e1;
  }
  .prose p:first-of-type::first-letter {
    /* Drop cap subtle */
    font-size: 1.05em;
    font-weight: 600;
  }
  .prose strong { color: #f8fafc; font-weight: 600; }
  .prose em { color: #e5e7eb; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 500; }
  .prose a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(129,140,248,.4);
    transition: all .2s;
    font-weight: 500;
  }
  .prose a:hover {
    color: var(--accent-hover);
    text-decoration-color: var(--accent-hover);
  }
  /* List: explicit list-style để override Tailwind reset (`ol,ul{list-style:none}`)
     làm bullet/number ẩn → user thấy items "cách cách" không liên kết */
  .prose ul { margin: 1em 0; padding-left: 1.5em; list-style: disc; }
  .prose ol { margin: 1em 0; padding-left: 1.5em; list-style: decimal; }
  .prose li { margin: .35em 0; color: #cbd5e1; padding-left: .15em; line-height: 1.65; }
  .prose ul li::marker { color: #818cf8; }
  .prose ol li::marker { color: #818cf8; font-weight: 700; }
  .prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin: .35em 0; }
  .prose blockquote {
    border-left: 4px solid #6366f1;
    padding: 1em 1.25em;
    background: linear-gradient(90deg, rgba(99,102,241,.08), transparent);
    color: #e5e7eb;
    margin: 1.5em 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.05em;
  }
  .prose blockquote p:first-of-type::first-letter { font-size: 1em; }
  .prose pre {
    background: #0a0f1a;
    border: 1px solid #1f2937;
    padding: 1em 1.25em;
    border-radius: 10px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 14px;
  }
  .prose pre code {
    color: #e5e7eb;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: .92em;
    line-height: 1.6;
  }
  .prose .inline-code {
    background: #1e293b;
    padding: .15em .45em;
    border-radius: 5px;
    font-size: .88em;
    color: #fbbf24;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid rgba(255,255,255,.06);
  }
  .prose .post-img {
    margin: 2em auto;
    border-radius: 12px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    border: 1px solid var(--border-soft);
  }
  .prose hr {
    border: none;
    border-top: 1px solid var(--border-soft);
    margin: 2.5em 0;
    position: relative;
  }
  .prose hr::after {
    content: '✦';
    position: absolute;
    left: 50%;
    top: -.7em;
    transform: translateX(-50%);
    background: var(--bg);
    padding: 0 1em;
    color: #6366f1;
    font-size: 1.2em;
  }
  .prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: .95em;
  }
  .prose th, .prose td {
    padding: .6em 1em;
    border: 1px solid var(--border);
    text-align: left;
  }
  .prose th {
    background: var(--bg-elev);
    font-weight: 600;
    color: #fff;
  }
  .prose td { color: #cbd5e1; }
  .prose tbody tr:nth-child(odd) { background: rgba(255,255,255,.02); }

  /* Card / Tag */
  .card {
    background: #0e1422;
    border: 1px solid #1f2937;
    border-radius: 16px;
    transition: all .3s cubic-bezier(.4,0,.2,1);
  }
  .card:hover {
    border-color: #4338ca;
    transform: translateY(-4px);
    box-shadow: 0 16px 40px -10px rgba(99,102,241,.3);
  }
  .tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1e293b;
    color: #a5b4fc;
    padding: .35em .85em;
    border-radius: 9999px;
    font-size: .8em;
    font-weight: 500;
    transition: all .2s;
    border: 1px solid rgba(99,102,241,.15);
  }
  .tag:hover {
    background: #312e81;
    color: #c7d2fe;
    border-color: rgba(99,102,241,.4);
    transform: translateY(-1px);
  }

  /* ════════════════════════════════════════════════ */
  /* HEADER NAV — Linear/Vercel style */
  /* ════════════════════════════════════════════════ */
  nav.top {
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(6,9,18,.7);
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 32px;
  }
  .nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    transition: opacity .2s;
  }
  .nav-logo:hover { opacity: .85; }
  .nav-logo-mark {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(99,102,241,.4), inset 0 0 0 1px rgba(255,255,255,.15);
    letter-spacing: 0;
  }
  .nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
  .nav-link {
    position: relative;
    padding: 8px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: color .2s, background .2s;
    letter-spacing: -0.005em;
  }
  .nav-link:hover { color: #fff; background: rgba(255,255,255,.04); }
  .nav-link.active { color: #fff; }
  .nav-link.active::after {
    content: '';
    position: absolute;
    left: 16px; right: 16px; bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    border-radius: 2px;
  }

  /* ═══ Dropdown menu (nav-dropdown) ═══ */
  .nav-dropdown {
    position: relative;
    display: inline-flex;
  }
  .nav-dropdown-trigger {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .nav-dropdown-trigger svg {
    width: 12px; height: 12px;
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    opacity: .7;
  }
  .nav-dropdown:hover .nav-dropdown-trigger svg,
  .nav-dropdown:focus-within .nav-dropdown-trigger svg { transform: rotate(180deg); opacity: 1; }
  .nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 290px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(13, 16, 28, .92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 16px 40px -8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.02) inset;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .2s, transform .2s, visibility .2s;
    z-index: 100;
    /* Tăng vùng hover bridge — tránh menu biến mất khi user di chuột giữa trigger và menu */
  }
  .nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px; left: 0; right: 0;
    height: 8px;
  }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-dropdown-menu a {
    position: relative;
    display: block;
    padding: 11px 14px;
    border-radius: 9px;
    text-decoration: none;
    transition: background .15s;
  }
  .nav-dropdown-menu a .it { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .nav-dropdown-menu a .nm {
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    transition: color .15s;
  }
  .nav-dropdown-menu a .ds {
    display: block;
    color: #64748b;
    font-size: 11.5px;
    font-weight: 400;
    margin-top: 2px;
    line-height: 1.4;
    letter-spacing: 0;
  }
  .nav-dropdown-menu a .ar {
    color: #475569;
    font-size: 14px;
    transition: transform .2s, color .2s;
    flex-shrink: 0;
  }
  .nav-dropdown-menu a:hover { background: rgba(255,255,255,.05); }
  .nav-dropdown-menu a:hover .nm { color: #fff; }
  .nav-dropdown-menu a:hover .ar { color: #a5b4fc; transform: translateX(3px); }
  .nav-dropdown-menu a.active {
    background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(236,72,153,.08));
  }
  .nav-dropdown-menu a.active .nm { color: #fff; }
  .nav-dropdown-menu a.active .ar { color: #a5b4fc; }
  /* Subtle separator line between items */
  .nav-dropdown-menu a + a { margin-top: 2px; }
  /* Highlight trigger when child page is active */
  .nav-dropdown.has-active .nav-dropdown-trigger { color: #fff; }
  .nav-dropdown.has-active .nav-dropdown-trigger::after {
    content: '';
    position: absolute;
    left: 16px; right: 16px; bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    border-radius: 2px;
  }
  /* Light theme */
  [data-theme="light"] .nav-dropdown-menu {
    background: rgba(255,255,255,.96);
    border-color: rgba(15,23,42,.08);
    box-shadow: 0 16px 40px -8px rgba(15,23,42,.15);
  }
  [data-theme="light"] .nav-dropdown-menu a:hover { background: rgba(15,23,42,.04); }
  [data-theme="light"] .nav-dropdown-menu a .nm { color: #0f172a; }
  [data-theme="light"] .nav-dropdown-menu a .ds { color: #94a3b8; }
  [data-theme="light"] .nav-dropdown-menu a .ar { color: #cbd5e1; }
  [data-theme="light"] .nav-dropdown-menu a:hover .nm { color: #4338ca; }
  [data-theme="light"] .nav-dropdown-menu a:hover .ar { color: #4338ca; }
  [data-theme="light"] .nav-dropdown-menu a.active { background: linear-gradient(135deg, #eef2ff, #fdf2f8); }
  [data-theme="light"] .nav-dropdown-menu a.active .nm { color: #4338ca; }
  .nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 0 0 1px rgba(99,102,241,.4) inset;
    letter-spacing: -0.005em;
  }
  .nav-cta:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 8px 20px rgba(99,102,241,.4), 0 0 0 1px rgba(99,102,241,.6) inset;
  }
  .nav-cta::after {
    content: '→';
    transition: transform .2s;
  }
  .nav-cta:hover::after { transform: translateX(3px); }

  /* Mobile */
  @media (max-width: 768px) {
    .nav-container { padding: 0 16px; gap: 12px; height: 56px; grid-template-columns: auto auto; }
    .nav-links { display: none; }
    .nav-logo { font-size: 16px; }
    .nav-logo-mark { width: 28px; height: 28px; font-size: 12px; }
    .nav-cta { padding: 8px 14px; font-size: 13px; }
  }
  @media (max-width: 380px) {
    .nav-cta::after { display: none; }
  }

  /* Light theme */
  [data-theme="light"] nav.top { background: rgba(255,255,255,.85); border-bottom-color: #e5e7eb; }
  [data-theme="light"] .nav-logo { color: #0f172a; }
  [data-theme="light"] .nav-link { color: #4b5563; }
  [data-theme="light"] .nav-link:hover { color: #0f172a; background: rgba(15,23,42,.04); }
  [data-theme="light"] .nav-link.active { color: #0f172a; }

  /* Reading progress bar */
  .reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #ec4899);
    width: 0%;
    z-index: 100;
    transition: width .1s;
  }

  /* Selection color */
  ::selection { background: rgba(99,102,241,.4); color: #fff; }

  /* Reduce motion */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  }
  /* Lite mode: máy yếu / saveData / 2G. KHÔNG dùng "animation: none" — sẽ kill forwards fill-mode
     → các element bắt đầu opacity:0 + animate sẽ kẹt vô hình. Rút duration về 0.01ms thay vào. */
  .lite *, .lite *::before, .lite *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .15s !important;
  }
  /* Mobile: backdrop-filter quá nặng cho SoC yếu — drop dưới 600px */
  @media (max-width: 600px) {
    nav.top { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background: rgba(6,9,18,.95); }
  }
  /* Off-screen content render trễ — scroll mượt hơn nhiều trên trang dài */
  article, .prose > section, footer { content-visibility: auto; contain-intrinsic-size: 1px 800px; }

  /* ════════════════════════════════════════════════ */
  /* RESPONSIVE */
  /* ════════════════════════════════════════════════ */
  @media (max-width: 768px) {
    .prose { font-size: 16.5px; line-height: 1.7; padding: 0 4px; }
    .prose h1 { font-size: 1.85em; }
    .prose h2 { font-size: 1.4em; margin-top: 1.8em; }
    .prose h3 { font-size: 1.2em; }
    .prose blockquote { padding: .8em 1em; font-size: 1em; }
    .prose pre { font-size: 13px; padding: .8em 1em; }
    .prose table { font-size: .85em; }
    .prose th, .prose td { padding: .4em .6em; }
  }
  @media (max-width: 480px) {
    .prose { font-size: 16px; }
    .prose h1 { font-size: 1.65em; }
    .prose h2 { font-size: 1.3em; }
  }
  .vd-footer {
    position: relative;
    background: linear-gradient(180deg, rgba(10,14,26,.4), rgba(5,8,15,.92));
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 56px 0 28px;
    margin-top: 80px;
    color: #94a3b8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  }
  .vd-footer-inner { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
  .vd-footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 36px;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .vd-footer-brand { max-width: 360px; }
  .vd-footer-logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .vd-footer-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
    color: #fff;
    border-radius: 9px;
    font-weight: 800; font-size: 15px;
    box-shadow: 0 6px 16px rgba(99,102,241,.4);
  }
  .vd-footer-brand-name {
    font-size: 19px; font-weight: 800;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -.02em;
  }
  .vd-footer-tagline {
    font-size: 13px;
    line-height: 1.6;
    color: #94a3b8;
    margin: 0 0 16px;
  }
  .vd-footer-social { display: flex; gap: 8px; }
  .vd-footer-social-btn {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    color: #94a3b8;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    transition: all .15s;
  }
  .vd-footer-social-btn:hover {
    transform: translateY(-2px);
    background: rgba(99,102,241,.16);
    border-color: rgba(99,102,241,.4);
    color: #a5b4fc;
    box-shadow: 0 6px 14px rgba(99,102,241,.25);
  }
  .vd-footer-col { display: flex; flex-direction: column; }
  .vd-footer-col-title {
    font-size: 11px; font-weight: 700;
    color: #c4b5fd;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 14px;
  }
  .vd-footer-link {
    display: block;
    font-size: 13px;
    color: #94a3b8;
    text-decoration: none;
    padding: 6px 0;
    transition: color .12s, transform .12s;
  }
  .vd-footer-link:hover { color: #a5b4fc; transform: translateX(3px); }
  .vd-footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 24px;
    flex-wrap: wrap; gap: 8px;
    font-size: 12.5px;
    color: #64748b;
  }
  .vd-footer-bottom p { margin: 0; }
  .vd-footer-brand-grad {
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: .02em;
    font-weight: 800;
  }

  /* Tablet — 2 col */
  @media (max-width: 1024px) {
    .vd-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
    .vd-footer-brand { grid-column: span 2; max-width: 100%; }
  }
  /* Mobile — stack */
  @media (max-width: 640px) {
    .vd-footer { padding: 36px 0 20px; margin-top: 48px; }
    .vd-footer-inner { padding: 0 20px; }
    .vd-footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; padding-bottom: 24px; }
    .vd-footer-brand { grid-column: span 2; }
    .vd-footer-bottom { flex-direction: column; text-align: center; }
    .vd-footer-tagline { font-size: 12.5px; }
  }

  /* Light theme — VidDrop blog/landing dùng dark default; nếu cần light theme:
     [data-theme="light"] .vd-footer { ... } */

/* ════════════════════════════════════════════════════════════════════ */
/* MOBILE PERF — drop GPU-heavy decorations dưới 768px / lite mode      */
/* ════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Blur(120px) trên orbs = GPU killer cho điện thoại tầm trung.
     Hide hoàn toàn — orb chỉ là decorative, không có content. */
  .hero-bg-orb { display: none !important; }
  /* Grid pattern radial mask cũng nặng — đơn giản hơn cho mobile */
  .grid-pattern { display: none !important; }
  /* Backdrop-filter blur(20px) gây giật mọi scroll — drop ở nav (đã có) + tất cả popup */
  .nav-dropdown-menu { backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
                       background: rgba(13, 16, 28, .98) !important; }
}
/* Lite mode — máy yếu / 2G / saveData: drop tất cả decoration nặng */
.lite .hero-bg-orb,
.lite .grid-pattern,
.lite .orb-1, .lite .orb-2, .lite .orb-3 { display: none !important; }
.lite .text-gradient { animation: none !important; }   /* gradient-shift loop tốn CPU */
.lite .badge-pill .dot { animation: none !important; box-shadow: 0 0 4px #10b981 !important; }

/* ════════════════════════════════════════════════════════════════════ */
/* HEAT SAVER — pause animations khi tab hidden hoặc element off-screen */
/* Zero UX impact: user không nhìn vào → pause vô hình.                   */
/* ════════════════════════════════════════════════════════════════════ */
body.tab-hidden *,
body.tab-hidden *::before,
body.tab-hidden *::after {
  animation-play-state: paused !important;
}
.anim-offscreen,
.anim-offscreen *,
.anim-offscreen::before,
.anim-offscreen::after {
  animation-play-state: paused !important;
}
