/*
Theme Name: iTàiLiệu Education Library
Theme URI: https://itailieu.com/
Author: iTàiLiệu
Description: Theme thư viện học liệu hiện đại dành riêng cho iTàiLiệu, tối ưu đọc, tìm kiếm và khám phá nội dung giáo dục.
Version: 1.0.4
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: itailieu
*/

:root {
  --brand: #1259a7;
  --brand-dark: #0a376d;
  --accent: #f28c28;
  --ink: #162235;
  --muted: #627083;
  --line: #dfe6ee;
  --soft: #f3f7fb;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 10px 32px rgba(24, 55, 91, .09);
  --container: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: #f7f9fc; font: 16px/1.72 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
img { max-width: 100%; height: auto; vertical-align: middle; }
a { color: var(--brand); text-decoration: none; transition: color .2s ease, background .2s ease, transform .2s ease; }
a:hover { color: var(--brand-dark); }
button, input, select, textarea { font: inherit; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.screen-reader-text:focus { clip: auto; width: auto; height: auto; padding: 10px; z-index: 9999; background: #fff; }
.container { width: min(calc(100% - 32px), var(--container)); margin-inline: auto; }
.site-main { min-width: 0; }

.utility-bar { background: var(--brand-dark); color: #dcecff; font-size: 13px; }
.utility-bar .container { display: flex; justify-content: space-between; gap: 24px; padding: 7px 0; }
.utility-bar a { color: #fff; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 100; }
.header-main { display: flex; align-items: center; min-height: 82px; gap: 32px; }
.site-branding { flex: 0 0 auto; }
.site-logo { display: block; width: 245px; max-height: 62px; object-fit: contain; object-position: left center; }
.main-navigation { margin-left: auto; }
.main-navigation ul { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.main-navigation a { display: block; padding: 12px 13px; color: var(--ink); font-size: 15px; font-weight: 700; border-radius: 8px; }
.main-navigation a:hover, .main-navigation .current-menu-item > a { background: var(--soft); color: var(--brand); }
.header-search { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff; }
.header-search:hover { background: var(--brand-dark); color: #fff; }
.menu-toggle { display: none; border: 0; border-radius: 8px; padding: 10px 12px; background: var(--brand); color: #fff; font-weight: 700; }

.hero { position: relative; min-height: 510px; display: grid; align-items: center; overflow: hidden; background: #132b47; color: #fff; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,34,67,.94) 0%, rgba(6,34,67,.72) 48%, rgba(6,34,67,.2) 100%); }
.hero-slider { position: absolute; inset: 0; }
.hero-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-slide { opacity: 0; transition: opacity .8s ease; }
.hero-slide.is-active { opacity: 1; }
.hero-content { position: relative; z-index: 1; max-width: 720px; padding: 76px 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 15px; color: #ffd09d; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; font-size: 13px; }
.hero h1 { margin: 0 0 18px; color: #fff; font-size: clamp(38px, 5vw, 66px); line-height: 1.08; letter-spacing: -.035em; }
.hero p { max-width: 640px; margin: 0 0 28px; color: #e8f1fc; font-size: 19px; }
.hero-search { display: flex; max-width: 650px; padding: 7px; background: #fff; border-radius: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.22); }
.hero-search label { flex: 1; }
.hero-search input { width: 100%; min-height: 50px; padding: 0 15px; border: 0; outline: 0; color: var(--ink); }
.hero-search button, .button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 22px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; cursor: pointer; }
.hero-search button:hover, .button:hover { background: #dc7414; color: #fff; transform: translateY(-1px); }
.slider-controls { display: flex; gap: 8px; margin-top: 22px; }
.slider-dot { width: 28px; height: 5px; padding: 0; border: 0; border-radius: 5px; background: rgba(255,255,255,.46); cursor: pointer; }
.slider-dot.is-active { background: var(--accent); }

.home-section { padding: 68px 0; }
.home-section.alt { background: var(--soft); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.18; letter-spacing: -.02em; }
.section-heading p { max-width: 590px; margin: 6px 0 0; color: var(--muted); }
.section-link { font-weight: 800; white-space: nowrap; }
.stats-grid, .feature-grid, .category-grid, .post-grid { display: grid; gap: 22px; }
.stats-grid { grid-template-columns: repeat(4, 1fr); margin-top: -45px; position: relative; z-index: 2; }
.stat-card { padding: 25px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card strong { display: block; color: var(--brand); font-size: 29px; line-height: 1.2; }
.stat-card span { color: var(--muted); font-size: 14px; }
.category-grid { grid-template-columns: repeat(4, 1fr); }
.category-card { min-height: 180px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 4px 18px rgba(24,55,91,.05); }
.category-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 17px; border-radius: 12px; background: #e8f2fd; color: var(--brand); font-weight: 900; }
.category-card h3 { margin: 0 0 7px; font-size: 20px; }
.category-card p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.category-card .count { font-size: 13px; font-weight: 700; color: var(--accent); }
.library-banner { position: relative; min-height: 360px; display: grid; align-items: center; overflow: hidden; background: var(--brand-dark); color: #fff; }
.library-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,34,67,.94), rgba(6,34,67,.45)); }
.library-banner > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.library-banner-content { position: relative; z-index: 1; padding-block: 60px; }
.library-banner-content h2 { max-width: 720px; margin: 0 0 12px; color: #fff; font-size: clamp(29px, 4vw, 44px); line-height: 1.18; }
.library-banner-content p { max-width: 600px; margin: 0 0 22px; color: #e5effa; }
.post-grid { grid-template-columns: repeat(3, 1fr); }
.post-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 5px 22px rgba(24,55,91,.06); }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-thumb { display: block; aspect-ratio: 16/10; overflow: hidden; background: #dce5ef; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.post-card:hover .card-thumb img { transform: scale(1.035); }
.card-body { padding: 21px; }
.card-category { display: inline-block; margin-bottom: 8px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.card-title { margin: 0 0 9px; font-size: 20px; line-height: 1.38; }
.card-title a { color: var(--ink); }
.card-excerpt { margin: 0; color: var(--muted); font-size: 14px; }
.card-meta { margin-top: 14px; color: #7b8797; font-size: 12px; }

.page-hero { position: relative; overflow: hidden; padding: 58px 0; background: linear-gradient(120deg, #0b3e79, #176bbd); color: #fff; }
.page-hero > .container { position: relative; z-index: 2; }
.category-hero { min-height: 300px; display: grid; align-items: center; background: #0b3e79; }
.category-hero::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(6,34,67,.95), rgba(6,34,67,.56)); }
.category-hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.page-hero h1 { margin: 6px 0 4px; color: #fff; font-size: clamp(32px, 5vw, 50px); line-height: 1.2; }
.page-hero p { max-width: 720px; margin: 9px 0 0; color: #dfedfb; }
.breadcrumb { font-size: 13px; color: #718096; }
.page-hero .breadcrumb, .page-hero .breadcrumb a { color: #d8eafb; }
.content-area { padding: 52px 0 76px; }
.content-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 38px; align-items: start; }
.content-surface { padding: clamp(24px, 4vw, 48px); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.entry-header h1 { margin: 10px 0 12px; font-size: clamp(30px, 4vw, 46px); line-height: 1.22; letter-spacing: -.025em; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 24px; color: var(--muted); font-size: 13px; }
.entry-featured { margin: 0 0 30px; overflow: hidden; border-radius: 12px; }
.entry-featured img { width: 100%; max-height: 520px; object-fit: cover; }
.entry-content { color: #28364a; font-size: 17px; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content h2, .entry-content h3 { margin-top: 1.65em; color: var(--ink); line-height: 1.3; }
.entry-content h2 { font-size: 29px; }
.entry-content h3 { font-size: 23px; }
.entry-content blockquote { margin: 26px 0; padding: 18px 24px; border-left: 4px solid var(--accent); background: #fff8ef; }
.entry-content table { width: 100%; border-collapse: collapse; }
.entry-content th, .entry-content td { padding: 11px; border: 1px solid var(--line); text-align: left; }
.entry-content .wp-block-button__link { background: var(--brand); }
.content-list > article + article { margin-top: 24px; }
.archive-card { display: grid; grid-template-columns: 260px 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.archive-card .card-thumb { aspect-ratio: auto; min-height: 220px; }
.archive-card .card-body { padding: 25px; }
.pagination { margin-top: 34px; }
.pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers { display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }

.sidebar { display: grid; gap: 22px; }
.widget { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.widget-title { margin: 0 0 16px; padding-bottom: 11px; border-bottom: 2px solid var(--soft); font-size: 19px; }
.widget ul { margin: 0; padding: 0; list-style: none; }
.widget li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.widget li:last-child { border: 0; }
.search-form { display: flex; }
.search-form label { flex: 1; }
.search-field { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px 0 0 8px; }
.search-submit { padding: 0 15px; border: 0; border-radius: 0 8px 8px 0; background: var(--brand); color: #fff; font-weight: 700; }
.related-posts { margin-top: 40px; }
.related-posts h2 { font-size: 26px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-grid .card-title { font-size: 16px; }

.site-footer { background: #092b52; color: #c9d8e9; }
.footer-main { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 36px; padding: 58px 0 46px; }
.footer-logo { width: 220px; margin-bottom: 16px; filter: brightness(0) invert(1); }
.footer-column h2 { margin: 0 0 17px; color: #fff; font-size: 17px; }
.footer-column ul { margin: 0; padding: 0; list-style: none; }
.footer-column li { margin-bottom: 8px; }
.footer-column a { color: #c9d8e9; }
.footer-column a:hover { color: #fff; }
.footer-bottom { padding: 18px 0; border-top: 1px solid rgba(255,255,255,.12); text-align: center; color: #dbe7f3; font-size: 14px; }
.empty-state { padding: 50px; text-align: center; border-radius: var(--radius); background: #fff; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.info-box { padding: 22px; border-left: 4px solid var(--brand); background: var(--soft); }

@media (max-width: 980px) {
  .menu-toggle { display: block; margin-left: auto; }
  .header-search { display: none; }
  .main-navigation { display: none; position: absolute; top: 100%; left: 0; right: 0; padding: 12px 16px 20px; border-top: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
  .main-navigation.is-open { display: block; }
  .main-navigation ul { display: block; }
  .main-navigation a { padding: 11px; }
  .content-layout { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(2, 1fr); }
  .stats-grid, .category-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-main { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .utility-bar .container { justify-content: center; text-align: center; }
  .utility-bar .utility-right { display: none; }
  .header-main { min-height: 70px; }
  .site-logo { width: 190px; }
  .hero { min-height: 540px; }
  .hero::before { background: rgba(6,34,67,.82); }
  .hero-content { padding: 56px 0 76px; }
  .hero-search { flex-direction: column; }
  .post-grid, .stats-grid, .category-grid, .sidebar, .related-grid, .contact-grid { grid-template-columns: 1fr; }
  .stats-grid { margin-top: -32px; }
  .section-heading { display: block; }
  .section-link { display: inline-block; margin-top: 10px; }
  .archive-card { grid-template-columns: 1fr; }
  .archive-card .card-thumb { aspect-ratio: 16/9; min-height: 0; }
  .content-area { padding: 30px 0 54px; }
  .content-surface { padding: 22px; }
  .footer-main { grid-template-columns: 1fr; padding: 45px 0 34px; }
}

@media print {
  .site-header, .utility-bar, .site-footer, .sidebar, .related-posts { display: none; }
  body { background: #fff; color: #000; }
  .content-layout { display: block; }
  .content-surface { border: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
