/*
Theme Name: Xalo Cong Nghe Portal
Theme URI: https://xalocongnghe.com/
Author: Xalo Cong Nghe
Author URI: https://xalocongnghe.com/
Description: Lightweight AI-native technology portal theme with discover-first architecture.
Version: 1.2.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 8.1
Text Domain: xalocongnghe-portal
*/

:root {
  --bg: #f3f7ff;
  --surface: #ffffff;
  --surface-2: #eff4ff;
  --text: #0f172a;
  --muted: #5b6475;
  --border: #dfe8ff;
  --primary: #2156e8;
  --primary-2: #1340bc;
  --accent: #11a2ff;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 8px 20px rgba(10, 32, 94, 0.06);
  --shadow-md: 0 18px 40px rgba(10, 32, 94, 0.08);
  --max: 1340px;
}

:root[data-theme='dark'] {
  --bg: #071028;
  --surface: #0d1a34;
  --surface-2: #122243;
  --text: #e6eefc;
  --muted: #95a6c9;
  --border: #203962;
  --primary: #4f7cff;
  --primary-2: #3867f5;
  --accent: #37d2ff;
  --shadow-sm: 0 10px 20px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 20px 40px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at 0 0, rgba(17, 162, 255, 0.18), transparent 38%), var(--bg);
  color: var(--text);
  line-height: 1.62;
}

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

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

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.wrap {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 9999;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--surface), transparent 18%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 74px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #2563eb, #0f7dff);
  box-shadow: var(--shadow-sm);
  position: relative;
  display: inline-block;
}

.brand-mark::before,
.brand-mark::after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 999px;
}

.brand-mark::before {
  width: 18px;
  height: 4px;
  top: 15px;
  left: 8px;
  transform: rotate(-38deg);
}

.brand-mark::after {
  width: 18px;
  height: 4px;
  top: 15px;
  left: 8px;
  transform: rotate(38deg);
}

.primary-nav {
  display: none;
}

.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
}

.primary-nav a {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
}

.primary-nav a:hover,
.primary-nav .current-menu-item > a {
  background: var(--surface-2);
  color: var(--primary);
}

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-mini {
  display: none;
  position: relative;
}

.search-mini input {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  width: 250px;
  color: var(--text);
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.cta-btn {
  border: 0;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

main.site-main {
  padding: 1.2rem 0 3rem;
}

.grid-main {
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.hero {
  overflow: hidden;
}

.hero-media {
  position: relative;
  min-height: 320px;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
  aspect-ratio: 5 / 3;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(8, 16, 35, 0.88));
  display: flex;
  align-items: end;
  padding: 1.4rem;
}

.hero-content h1,
.hero-content h2 {
  margin: 0.55rem 0;
  color: #fff;
  font-size: clamp(1.45rem, 2.8vw, 2.5rem);
  line-height: 1.2;
}

.kicker {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(24, 115, 255, 0.85);
  display: inline-block;
  padding: 0.34rem 0.55rem;
  border-radius: 999px;
}

.meta-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.88rem;
  color: #dae6ff;
}

.side-list {
  padding: 1rem;
}

.side-item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.side-item img {
  width: 100%;
  height: 68px;
  object-fit: cover;
  aspect-ratio: 16 / 10;
}

.side-item h3 {
  margin: 0.15rem 0;
  font-size: 0.99rem;
  line-height: 1.35;
}

.side-item .tiny {
  color: var(--muted);
  font-size: 0.82rem;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.85rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1.24rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem;
  min-height: 88px;
}

.category-card strong {
  display: block;
  color: var(--text);
}

.category-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-grid {
  display: grid;
  gap: 0.95rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-card {
  overflow: hidden;
}

.post-card-media {
  display: block;
}

.post-card-media img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 0;
  aspect-ratio: 16 / 9;
}

.post-card-body {
  padding: 0.95rem;
}

.post-card h3 {
  margin: 0.4rem 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.post-card p {
  margin: 0.3rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.two-col {
  display: grid;
  gap: 1rem;
}

.list-clean {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-clean li {
  border-top: 1px solid var(--border);
  padding: 0.72rem 0;
}

.resource-list a {
  color: var(--text);
  font-weight: 600;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  text-align: center;
}

.metric strong {
  display: block;
  font-size: 1.4rem;
}

.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.article-panel {
  padding: 1.2rem;
}

.article-title {
  font-size: clamp(1.55rem, 3.5vw, 2.55rem);
  line-height: 1.2;
  margin: 0.6rem 0;
}

.summary-box,
.takeaway-box,
.toc-box,
.faq-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem;
  margin: 1rem 0;
}

.entry-content h2,
.entry-content h3 {
  scroll-margin-top: 90px;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.entry-content td,
.entry-content th {
  border: 1px solid var(--border);
  padding: 0.55rem;
  text-align: left;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 1.8rem 0;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface), transparent 12%);
}

.footer-grid {
  display: grid;
  gap: 1rem;
}

.footer-note {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (min-width: 768px) {
  .grid-main {
    grid-template-columns: 2fr 1fr;
  }

  .two-col {
    grid-template-columns: 2fr 1fr;
  }

  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .primary-nav {
    display: block;
  }

  .search-mini {
    display: block;
  }

  .hero-media {
    min-height: 420px;
  }

  .post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .article-wrap {
    grid-template-columns: minmax(0, 1fr) 310px;
  }
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal;
}

.screen-reader-text:focus {
  clip: auto;
  clip-path: none;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  width: auto;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mobile-trending {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0 0 0.75rem;
  scrollbar-width: thin;
}

.mobile-trending a {
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
}

.breadcrumb {
  margin-bottom: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.breadcrumb .sep {
  color: var(--muted);
}

.discover-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.load-more-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  font-weight: 700;
  padding: 0.72rem 1rem;
  min-width: 220px;
  cursor: pointer;
}

.load-more-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.load-more-btn:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

@media (max-width: 767px) {
  .cta-btn {
    display: none;
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (min-width: 1024px) {
  .mobile-trending {
    display: none;
  }
}

.mobile-menu-btn {
  display: inline-grid;
}


@media (max-width: 1023px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 0.75rem 0;
  }

  body.no-scroll {
    overflow: hidden;
  }

  .primary-nav {
    display: none;
    width: 100%;
    order: 10;
  }

  body.nav-open .primary-nav {
    display: block;
  }

  .primary-nav ul {
    flex-direction: column;
    gap: 0.3rem;
    margin: 0.7rem 0 0;
  }

  .primary-nav a {
    display: block;
  }

  .header-tools {
    margin-left: auto;
  }
}

@media (min-width: 1024px) {
  .mobile-menu-btn {
    display: none;
  }
}

.context-hero {
  padding: 1.15rem;
  margin-bottom: 1rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface), #8ec2ff 10%), var(--surface));
}

.context-kicker {
  background: rgba(33, 86, 232, 0.16);
  color: var(--primary);
}

.context-title {
  margin: 0.6rem 0 0.4rem;
  font-size: clamp(1.38rem, 2.8vw, 2.2rem);
  line-height: 1.2;
}

.context-summary {
  margin: 0;
  color: var(--muted);
}

.context-meta {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.archive-layout {
  display: grid;
  gap: 1rem;
}

.archive-main,
.archive-side {
  padding: 1rem;
}

.context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.context-chips a {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.36rem 0.68rem;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.84rem;
}

.context-chips a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-wrap {
  margin-top: 1rem;
}

.pagination-wrap .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pagination-wrap .page-numbers {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  color: var(--text);
  background: var(--surface-2);
}

.pagination-wrap .page-numbers.current {
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
}

.search-inline {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
}

.search-inline input {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0.68rem 0.8rem;
}

.search-inline .load-more-btn {
  min-width: 140px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: color-mix(in srgb, var(--surface-2), transparent 20%);
}

.empty-state h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@media (min-width: 1024px) {
  .archive-layout {
    grid-template-columns: 2fr 1fr;
  }
}

@media (max-width: 640px) {
  .search-inline {
    grid-template-columns: 1fr;
  }

  .search-inline .load-more-btn {
    width: 100%;
  }
}


.post-grid .post-card {
  content-visibility: auto;
  contain-intrinsic-size: 380px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
