/*
Theme Name: GoManga
Theme URI: https://go-manga.net
Author: GoManga Team
Author URI: https://go-manga.net
Description: Giao diện WordPress cho GoManga - cổng thông tin, đánh giá và bảng xếp hạng truyện tranh manga, manhwa, manhua dành cho độc giả Việt Nam. Bố cục chuẩn header/footer/sidebar/template-parts, tối ưu tốc độ và hiển thị tốt trên di động.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gomanga
Tags: blog, news, two-columns, right-sidebar, custom-menu, custom-logo, featured-images, translation-ready
*/

:root {
  --gm-primary: #ff5722;
  --gm-primary-dark: #d84315;
  --gm-dark: #181c26;
  --gm-dark-soft: #232836;
  --gm-text: #2b2f3a;
  --gm-muted: #6b7280;
  --gm-border: #e5e7eb;
  --gm-bg: #f6f7f9;
  --gm-white: #ffffff;
  --gm-radius: 10px;
  --gm-shadow: 0 2px 10px rgba(17, 24, 39, .08);
  --gm-shadow-lg: 0 10px 30px rgba(17, 24, 39, .14);
  --gm-max: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--gm-text);
  background: var(--gm-bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gm-primary-dark); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--gm-primary); }
h1, h2, h3, h4, h5, h6 { line-height: 1.3; color: var(--gm-dark); margin: 0 0 .6em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1.1em; }
figure { margin: 0 0 1.2em; }
blockquote {
  margin: 1.2em 0; padding: .8em 1.2em;
  border-left: 4px solid var(--gm-primary);
  background: var(--gm-white); border-radius: 0 var(--gm-radius) var(--gm-radius) 0;
  color: var(--gm-muted);
}
table { width: 100%; border-collapse: collapse; margin-bottom: 1.2em; background: var(--gm-white); }
th, td { padding: .6em .8em; border: 1px solid var(--gm-border); text-align: left; }
th { background: var(--gm-bg); }

.gm-container { max-width: var(--gm-max); margin: 0 auto; padding: 0 20px; }
.screen-reader-text {
  border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
  height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute;
}
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--gm-dark); color: #fff; padding: 8px 16px; z-index: 999; }
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  background: var(--gm-white);
  box-shadow: var(--gm-shadow);
  position: sticky; top: 0; z-index: 90;
}
.gm-header-inner { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.site-branding { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.site-branding img.gm-logo { height: 48px; width: auto; }
.site-branding .site-title { font-size: 1.3rem; font-weight: 800; margin: 0; }
.site-branding .site-title a { color: var(--gm-dark); }

.main-navigation { margin-left: auto; }
.main-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.main-navigation li { position: relative; }
.main-navigation a {
  display: block; padding: 10px 14px; font-weight: 600; color: var(--gm-text);
  border-radius: 8px;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a { color: var(--gm-primary); background: #fff3ef; }
.main-navigation ul ul {
  position: absolute; left: 0; top: 100%; min-width: 210px; flex-direction: column;
  background: var(--gm-white); box-shadow: var(--gm-shadow-lg); border-radius: var(--gm-radius);
  padding: 6px; opacity: 0; visibility: hidden; transform: translateY(8px); transition: all .2s ease;
}
.main-navigation li:hover > ul,
.main-navigation li:focus-within > ul { opacity: 1; visibility: visible; transform: translateY(0); }

.gm-header-search { margin-left: 8px; }
.menu-toggle {
  display: none; margin-left: auto; background: none; border: 1px solid var(--gm-border);
  border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.menu-toggle .bars { display: block; width: 22px; height: 2px; background: var(--gm-dark); position: relative; }
.menu-toggle .bars::before, .menu-toggle .bars::after {
  content: ""; position: absolute; left: 0; width: 22px; height: 2px; background: var(--gm-dark);
}
.menu-toggle .bars::before { top: -7px; }
.menu-toggle .bars::after { top: 7px; }

/* ---------- Search form ---------- */
.gm-search-form { display: flex; gap: 6px; }
.gm-search-form input[type="search"] {
  padding: 9px 12px; border: 1px solid var(--gm-border); border-radius: 8px;
  font-size: .95rem; min-width: 160px; background: var(--gm-bg);
}
.gm-search-form input[type="search"]:focus { outline: 2px solid var(--gm-primary); border-color: transparent; }
.gm-search-form button {
  padding: 9px 14px; border: 0; border-radius: 8px; background: var(--gm-primary);
  color: #fff; font-weight: 700; cursor: pointer; transition: background .2s ease;
}
.gm-search-form button:hover { background: var(--gm-primary-dark); }

/* ---------- Hero / slider ---------- */
.gm-hero { position: relative; overflow: hidden; background: var(--gm-dark); }
.gm-hero-slide {
  position: relative; display: none; min-height: 420px; align-items: center;
}
.gm-hero-slide.is-active { display: flex; }
.gm-hero-slide img.gm-hero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .38;
}
.gm-hero-content { position: relative; z-index: 2; padding: 70px 0; max-width: 640px; }
.gm-hero-content .gm-kicker {
  display: inline-block; background: var(--gm-primary); color: #fff; font-size: .8rem;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.gm-hero-content h1, .gm-hero-content h2 { color: #fff; font-size: 2.3rem; margin-bottom: .4em; }
.gm-hero-content p { color: #cfd4dd; font-size: 1.06rem; }
.gm-hero-dots { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: 8px; }
.gm-hero-dots button {
  width: 11px; height: 11px; border-radius: 50%; border: 0; background: rgba(255,255,255,.4); cursor: pointer; padding: 0;
}
.gm-hero-dots button.is-active { background: var(--gm-primary); }
.gm-btn {
  display: inline-block; background: var(--gm-primary); color: #fff !important; font-weight: 700;
  padding: 12px 26px; border-radius: 8px; transition: background .2s ease, transform .2s ease;
}
.gm-btn:hover { background: var(--gm-primary-dark); transform: translateY(-2px); }
.gm-btn--ghost { background: transparent; border: 2px solid rgba(255,255,255,.6); margin-left: 10px; }
.gm-btn--ghost:hover { background: rgba(255,255,255,.12); }

/* ---------- Sections ---------- */
.gm-section { padding: 52px 0; }
.gm-section--alt { background: var(--gm-white); }
.gm-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.gm-section-head h2 { margin: 0; position: relative; padding-left: 14px; }
.gm-section-head h2::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 5px;
  border-radius: 3px; background: var(--gm-primary);
}
.gm-section-head .gm-more { font-weight: 700; white-space: nowrap; }

/* ---------- Grids & cards ---------- */
.gm-grid { display: grid; gap: 24px; }
.gm-grid--3 { grid-template-columns: repeat(3, 1fr); }
.gm-grid--4 { grid-template-columns: repeat(4, 1fr); }

.gm-card {
  background: var(--gm-white); border-radius: var(--gm-radius); overflow: hidden;
  box-shadow: var(--gm-shadow); transition: transform .2s ease, box-shadow .2s ease;
  display: flex; flex-direction: column;
}
.gm-card:hover { transform: translateY(-4px); box-shadow: var(--gm-shadow-lg); }
.gm-card-thumb { position: relative; aspect-ratio: 16/10; overflow: hidden; }
.gm-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.gm-card:hover .gm-card-thumb img { transform: scale(1.05); }
.gm-card-cat {
  position: absolute; top: 12px; left: 12px; background: var(--gm-primary); color: #fff;
  font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.gm-card-cat:hover { color: #fff; background: var(--gm-primary-dark); }
.gm-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.gm-card-body h3 { font-size: 1.08rem; margin-bottom: .5em; }
.gm-card-body h3 a { color: var(--gm-dark); }
.gm-card-body h3 a:hover { color: var(--gm-primary); }
.gm-card-excerpt { color: var(--gm-muted); font-size: .93rem; flex: 1; }
.gm-card-meta { margin-top: 12px; font-size: .82rem; color: var(--gm-muted); display: flex; gap: 12px; flex-wrap: wrap; }

.gm-cat-card { position: relative; border-radius: var(--gm-radius); overflow: hidden; aspect-ratio: 4/3; display: block; }
.gm-cat-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.gm-cat-card:hover img { transform: scale(1.06); }
.gm-cat-card .gm-cat-overlay {
  position: absolute; inset: 0; background: linear-gradient(180deg, rgba(24,28,38,0) 30%, rgba(24,28,38,.85) 100%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 18px;
}
.gm-cat-card .gm-cat-name { color: #fff; font-weight: 800; font-size: 1.1rem; }
.gm-cat-card .gm-cat-count { color: #d5d9e0; font-size: .85rem; }

/* ---------- Content layout ---------- */
.gm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 32px; padding: 44px 0 60px; }
.gm-layout--full { grid-template-columns: minmax(0, 1fr); }
.gm-main { min-width: 0; }

.gm-breadcrumb { font-size: .86rem; color: var(--gm-muted); margin-bottom: 18px; }
.gm-breadcrumb a { color: var(--gm-muted); }
.gm-breadcrumb a:hover { color: var(--gm-primary); }
.gm-breadcrumb .sep { margin: 0 7px; color: #c3c8d1; }

.gm-article {
  background: var(--gm-white); border-radius: var(--gm-radius); box-shadow: var(--gm-shadow);
  padding: 34px 38px; overflow: hidden;
}
.gm-article .entry-title { font-size: 1.9rem; }
.entry-meta { color: var(--gm-muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.entry-meta a { color: var(--gm-primary-dark); font-weight: 600; }
.gm-featured { margin: 0 -38px 26px; }
.gm-featured img { width: 100%; }
.entry-content { font-size: 1.02rem; }
.entry-content h2 { margin-top: 1.4em; }
.entry-content img { border-radius: var(--gm-radius); }
.entry-content ul, .entry-content ol { padding-left: 1.4em; margin-bottom: 1.1em; }
.gm-tags { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px; }
.gm-tags a {
  background: var(--gm-bg); border: 1px solid var(--gm-border); border-radius: 999px;
  font-size: .82rem; padding: 4px 12px; color: var(--gm-muted);
}
.gm-tags a:hover { border-color: var(--gm-primary); color: var(--gm-primary); }

.gm-archive-header {
  background: var(--gm-dark); color: #fff; border-radius: var(--gm-radius);
  padding: 34px 38px; margin-bottom: 30px; position: relative; overflow: hidden;
}
.gm-archive-header img.gm-archive-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.gm-archive-header .inner { position: relative; z-index: 2; }
.gm-archive-header h1 { color: #fff; margin-bottom: .3em; }
.gm-archive-header p { color: #cfd4dd; margin: 0; max-width: 720px; }

/* ---------- Related ---------- */
.gm-related { margin-top: 40px; }
.gm-related h2 { font-size: 1.3rem; }

/* ---------- Pagination ---------- */
.gm-pagination { margin-top: 36px; display: flex; justify-content: center; }
.gm-pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.gm-pagination .page-numbers {
  display: inline-block; min-width: 42px; text-align: center; padding: 9px 12px;
  background: var(--gm-white); border: 1px solid var(--gm-border); border-radius: 8px;
  font-weight: 600; color: var(--gm-text);
}
.gm-pagination .page-numbers.current, .gm-pagination .page-numbers:hover {
  background: var(--gm-primary); border-color: var(--gm-primary); color: #fff;
}
.post-navigation { margin-top: 30px; }
.post-navigation .nav-links { display: flex; justify-content: space-between; gap: 16px; }
.post-navigation a { font-weight: 600; }

/* ---------- Sidebar ---------- */
.gm-sidebar { min-width: 0; }
.gm-widget {
  background: var(--gm-white); border-radius: var(--gm-radius); box-shadow: var(--gm-shadow);
  padding: 22px 24px; margin-bottom: 24px;
}
.gm-widget .widget-title, .gm-widget h2 {
  font-size: 1.05rem; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--gm-primary);
}
.gm-widget ul { list-style: none; margin: 0; padding: 0; }
.gm-widget li { padding: 8px 0; border-bottom: 1px dashed var(--gm-border); }
.gm-widget li:last-child { border-bottom: 0; }
.gm-widget a { color: var(--gm-text); font-weight: 500; }
.gm-widget a:hover { color: var(--gm-primary); }
.gm-widget .post-date { display: block; font-size: .8rem; color: var(--gm-muted); }
.gm-mini { display: flex; gap: 12px; align-items: center; }
.gm-mini img { width: 76px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.gm-mini .gm-mini-title { font-size: .92rem; line-height: 1.4; font-weight: 600; }

/* ---------- 404 / none ---------- */
.gm-none { text-align: center; padding: 70px 20px; }
.gm-none .gm-404-code { font-size: 5rem; font-weight: 900; color: var(--gm-primary); line-height: 1; margin-bottom: 10px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--gm-dark); color: #b7bdc9; margin-top: 40px; }
.gm-footer-cols {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; padding: 52px 0 40px;
}
.site-footer h3 { color: #fff; font-size: 1.02rem; margin-bottom: 16px; }
.site-footer p { color: #b7bdc9; font-size: .93rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { padding: 5px 0; }
.site-footer a { color: #b7bdc9; }
.site-footer a:hover { color: var(--gm-primary); }
.gm-footer-logo { height: 44px; width: auto; margin-bottom: 14px; background: #fff; border-radius: 8px; padding: 4px 10px; }
.gm-footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08); padding: 18px 0; font-size: .88rem;
  text-align: center; color: #8b91a0;
}

/* ---------- Back to top ---------- */
.gm-top {
  position: fixed; right: 22px; bottom: 22px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--gm-primary); color: #fff; border: 0; cursor: pointer; font-size: 1.1rem;
  box-shadow: var(--gm-shadow-lg); opacity: 0; visibility: hidden; transition: all .25s ease; z-index: 80;
}
.gm-top.is-visible { opacity: 1; visibility: visible; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .gm-grid--4 { grid-template-columns: repeat(3, 1fr); }
  .gm-layout { grid-template-columns: minmax(0, 1fr); }
  .gm-header-search { display: none; }
}
@media (max-width: 782px) {
  .menu-toggle { display: block; }
  .main-navigation {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--gm-white); box-shadow: var(--gm-shadow-lg); padding: 10px 16px 16px;
  }
  .main-navigation.toggled { display: block; }
  .main-navigation ul { flex-direction: column; }
  .main-navigation ul ul {
    position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding-left: 16px;
  }
  .gm-grid--3, .gm-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .gm-hero-content h1, .gm-hero-content h2 { font-size: 1.7rem; }
  .gm-hero-slide { min-height: 340px; }
  .gm-article { padding: 24px 20px; }
  .gm-featured { margin: 0 -20px 20px; }
  .gm-footer-cols { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 520px) {
  .gm-grid--3, .gm-grid--4 { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
  .gm-section { padding: 38px 0; }
}
