/*
Theme Name: Minimal Blog
Theme URI: https://example.com/minimal-blog
Author: Your Name
Author URI: https://example.com
Description: Theme blog tối giản, hỗ trợ light/dark mode, sidebar widget, ảnh đại diện và sẵn sàng đa ngôn ngữ. Dùng lại được cho nhiều website khác nhau.
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: minimal-blog
Tags: blog, two-columns, right-sidebar, custom-menu, custom-logo, featured-images, translation-ready, dark-mode, threaded-comments
*/

/* ===== Theme tokens ===== */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --text: #1a1a1a;
  --text-soft: #5b6168;
  --border: #e6e8eb;
  --accent: #2563eb;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--bg));
  --max-width: 1100px;
  --radius: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1115;
  --bg-soft: #171a21;
  --text: #e8eaed;
  --text-soft: #9aa1ab;
  --border: #262b34;
  --accent: #60a5fa;
  /* --accent-soft tự suy ra từ --accent + --bg ở :root */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Accessibility ===== */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  position: absolute !important;
  word-wrap: normal !important;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.site-branding { display: flex; flex-direction: column; }
.site-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.site-title:hover { text-decoration: none; }
.site-description { font-size: 13px; color: var(--text-soft); }
.custom-logo { max-height: 44px; width: auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-menu a {
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 500;
}
.nav-menu a:hover { color: var(--text); text-decoration: none; }
.nav-menu .current-menu-item > a,
.nav-menu .current_page_item > a { color: var(--text); }
.nav-menu .sub-menu { display: none; } /* depth=1 mặc định */

.theme-toggle {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
  flex: none;
}
.theme-toggle:hover { background: var(--accent-soft); }

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  padding-top: 40px;
  padding-bottom: 64px;
}
.content { min-width: 0; }

/* ===== Post list ===== */
.page-heading {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-soft);
  margin: 0 0 24px;
}
.page-heading span { color: var(--text); }
.archive-desc { color: var(--text-soft); margin: -8px 0 28px; }

.post-card {
  padding: 0 0 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.post-card:last-of-type { border-bottom: none; }
.post-card h2 {
  font-size: 26px;
  line-height: 1.3;
  margin: 0 0 8px;
  letter-spacing: -.02em;
}
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--accent); text-decoration: none; }
.post-thumb { display: block; margin-bottom: 14px; }
.post-thumb img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

.post-meta {
  font-size: 13.5px;
  color: var(--text-soft);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.post-meta .tag {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 9px;
  border-radius: 99px;
  font-size: 12.5px;
}
.post-meta .tag:hover { text-decoration: none; }
.post-excerpt { color: var(--text-soft); margin: 0 0 14px; }
.read-more { font-size: 14.5px; font-weight: 600; }

.sticky { border-left: 3px solid var(--accent); padding-left: 18px; }

/* ===== Single post / Page (prose) ===== */
.article-header { margin-bottom: 28px; }
.article-header h1 {
  font-size: 38px;
  line-height: 1.2;
  letter-spacing: -.025em;
  margin: 10px 0 14px;
}
.prose { font-size: 18px; }
.prose p { margin: 0 0 20px; }
.prose h2 { font-size: 26px; margin: 38px 0 14px; letter-spacing: -.02em; }
.prose h3 { font-size: 21px; margin: 30px 0 10px; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 24px; }
.prose li { margin-bottom: 6px; }
.prose blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}
.prose pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 14.5px;
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 14.5px;
}
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: var(--radius); }
.featured-img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 28px;
  border: 1px solid var(--border);
}

/* WordPress media alignment */
.alignleft { float: left; margin: 6px 24px 16px 0; }
.alignright { float: right; margin: 6px 0 16px 24px; }
.aligncenter { display: block; margin: 16px auto; }
.alignwide { margin-left: -40px; margin-right: -40px; max-width: none; }
.wp-caption { max-width: 100%; }
.wp-caption-text, .wp-element-caption {
  font-size: 13.5px;
  color: var(--text-soft);
  text-align: center;
  margin-top: 6px;
}
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }

/* ===== Sidebar ===== */
.sidebar { font-size: 15px; }
.widget { margin-bottom: 36px; }
.widget-title,
.widget h2,
.widget h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-soft);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.search-form { display: flex; gap: 8px; }
.search-form .search-field {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
}
.search-form .search-field:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search-form .search-submit {
  padding: 9px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 14.5px;
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { margin-bottom: 10px; }
.widget li a { color: var(--text-soft); }
.widget li a:hover { color: var(--accent); text-decoration: none; }
.widget .children { padding-left: 16px; margin-top: 10px; }
.cat-list li,
.widget_categories li,
.widget_archive li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.widget_recent_entries li a { color: var(--text); font-weight: 500; }
.widget select { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }

/* ===== Pagination ===== */
.pagination,
.navigation.pagination .nav-links {
  display: flex;
  gap: 8px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.page-numbers,
.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--text-soft);
  line-height: 1;
}
.page-numbers.current,
.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
a.page-numbers:hover,
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Post navigation (prev/next) */
.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
}
.post-navigation .nav-subtitle { display: block; color: var(--text-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

/* ===== Comments ===== */
.comments-area { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.comments-title { font-size: 22px; margin: 0 0 24px; }
.comment-list { list-style: none; margin: 0 0 32px; padding: 0; }
.comment-list ol.children { list-style: none; padding-left: 28px; }
.comment-body { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-author { font-weight: 600; font-size: 15px; }
.comment-author .avatar { border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.comment-metadata { font-size: 13px; color: var(--text-soft); margin-bottom: 8px; }
.comment-metadata a { color: var(--text-soft); }
.reply a { font-size: 13.5px; font-weight: 600; }
.comment-respond { margin-top: 24px; }
.comment-form label { display: block; font-size: 14px; margin-bottom: 4px; color: var(--text-soft); }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}
.comment-form .submit, .form-submit input {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-soft);
  font-size: 14.5px;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.footer-menu { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; }
.footer-menu a { color: var(--text-soft); }

/* ===== Front page: hero & posts grid ===== */
.hero {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.hero .container { padding-top: 64px; padding-bottom: 64px; }
.hero-title {
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -.03em;
  margin: 0 0 16px;
  max-width: 16ch;
}
.hero-sub {
  font-size: 19px;
  color: var(--text-soft);
  margin: 0 0 28px;
  max-width: 60ch;
}
.hero-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 16px;
}
.hero-btn:hover { text-decoration: none; opacity: .92; }

.front-intro { padding-top: 48px; }
.front-posts { padding-top: 48px; padding-bottom: 64px; }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}
.grid-card h2 { font-size: 22px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.01em; }
.grid-card h2 a { color: var(--text); }
.grid-card h2 a:hover { color: var(--accent); text-decoration: none; }
.grid-card-thumb { display: block; margin-bottom: 14px; }
.grid-card-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.front-more { text-align: center; margin-top: 48px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar {
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 32px;
  }
  .article-header h1 { font-size: 30px; }
  .site-nav, .nav-menu { gap: 16px; }
  .alignwide { margin-left: 0; margin-right: 0; }
  .posts-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 32px; }
  .hero .container { padding-top: 48px; padding-bottom: 48px; }
}
@media (max-width: 520px) {
  .nav-menu { display: none; }
}
