/*
Theme Name: All Math Solver Blog
Theme URI: https://allmathsolver.com/blog
Author: All Math Solver
Author URI: https://allmathsolver.com
Description: Blog theme for All Math Solver. Uses the main site's header, menus, footer, dark mode and language switcher, with the original blog card and article design.
Version: 1.0.1
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: allmathsolver
*/

/* The header, menus, footer, colours and dark mode come from the main site's stylesheet
   (/css/style.css, loaded by functions.php), so the blog always matches the rest of the site.
   This file only adds the blog's own pieces. */

/* ---------- layout: the blog has no "Recents" sidebar ---------- */
.ams-blog .app-layout { min-height: calc(100vh - 60px); }
.ams-blog .main-content { overflow: visible; }

/* ---------- blog list (same look as the old built-in blog) ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  text-align: left;
}
.blog-card {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  transition: transform 0.15s, border-color 0.15s;
  cursor: pointer;
}
.blog-card:hover {
  border-color: var(--brand-green);
  transform: translateY(-2px);
}
.blog-card-thumb {
  display: block;
  margin: -20px -20px 16px;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 7;
  background: var(--bg-tertiary);
}
.blog-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-green);
  margin-bottom: 8px;
}
.blog-meta a { color: inherit; text-decoration: none; }
.blog-meta a:hover { text-decoration: underline; }
.blog-card h2,
.blog-card h3 {
  font-size: 17px;
  color: var(--text-main);
  margin-bottom: 8px;
  font-weight: 700;
  line-height: 1.35;
}
.blog-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.blog-card-link { color: inherit; text-decoration: none; }
.blog-card-link:hover { text-decoration: underline; }
.btn-read-article {
  background: rgba(83, 85, 141, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--brand-green);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-read-article:hover { background: var(--brand-green); color: #fff; }

.blog-empty { color: var(--text-muted); font-size: 14.5px; padding: 18px 0; }

/* category chips under the heading */
.blog-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: -8px 0 22px; }
.blog-cats a {
  font-size: 12.5px; font-weight: 600; text-decoration: none;
  color: var(--text-main); background: var(--bg-secondary);
  border: 1px solid var(--border-color); border-radius: 20px; padding: 5px 12px;
}
.blog-cats a:hover, .blog-cats a.current { border-color: var(--brand-green); color: var(--brand-green); }

/* search box */
.blog-search { display: flex; gap: 8px; max-width: 460px; margin: 0 auto 22px; }
.blog-search input[type="search"] {
  flex: 1; min-width: 0; padding: 9px 12px; font-size: 14px; font-family: inherit;
  border-radius: 8px; border: 1px solid var(--border-color);
  background: var(--bg-secondary); color: var(--text-main);
}
.blog-search input[type="search"]:focus { outline: 2px solid var(--brand-green); outline-offset: 1px; }
.blog-search button {
  padding: 9px 14px; border-radius: 8px; border: none; cursor: pointer; font-weight: 700; font-family: inherit;
  background: var(--brand-green); color: #fff; display: inline-flex; align-items: center; gap: 6px;
}

/* pagination */
.blog-pagination { margin-top: 26px; }
.blog-pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.blog-pagination .page-numbers {
  min-width: 36px; padding: 7px 11px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 13.5px;
  border: 1px solid var(--border-color); color: var(--text-main); background: var(--bg-secondary);
}
.blog-pagination .page-numbers.current, .blog-pagination a.page-numbers:hover { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.blog-pagination .page-numbers.dots { border: none; background: none; }

/* ---------- article page (same look as the old article reader) ---------- */
.btn-back-to-blogs {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 7px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  text-decoration: none;
}
.btn-back-to-blogs:hover { background: var(--border-color); }
.article-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.article-header .badge-tag { text-decoration: none; }
.article-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin: 8px 0;
  line-height: 1.3;
}
.article-featured { margin: 0 0 20px; border-radius: 10px; overflow: hidden; }
.article-featured img { width: 100%; height: auto; display: block; }

/* everything written in the WordPress editor */
.article-content { color: var(--text-muted); font-size: 14.5px; line-height: 1.7; overflow-wrap: break-word; }
.article-content > * + * { margin-top: 0; }
.article-content h2 { font-size: 20px; font-weight: 800; color: var(--text-main); margin: 26px 0 10px; line-height: 1.35; }
.article-content h3 { font-size: 17px; font-weight: 700; color: var(--text-main); margin: 18px 0 8px; }
.article-content h4, .article-content h5, .article-content h6 { font-size: 15px; font-weight: 700; color: var(--text-main); margin: 16px 0 6px; }
.article-content p { font-size: 14.5px; line-height: 1.7; color: var(--text-muted); margin-bottom: 14px; }
.article-content a { color: var(--brand-green); font-weight: 600; }
.article-content strong { color: var(--text-main); }
.article-content ul, .article-content ol { margin: 0 0 14px 22px; padding: 0; }
.article-content li { margin-bottom: 6px; }
.article-content img { max-width: 100%; height: auto; border-radius: 8px; }
.article-content figure { margin: 18px 0; max-width: 100%; }
.article-content figcaption, .article-content .wp-caption-text { font-size: 12.5px; color: var(--text-muted); text-align: center; margin-top: 6px; }
.article-content blockquote,
.article-box-callout {
  background: var(--bg-secondary);
  border-left: 4px solid var(--brand-green);
  padding: 14px 16px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--bg-tertiary); padding: 1px 5px; border-radius: 4px; }
.article-content pre { background: var(--bg-tertiary); padding: 14px 16px; border-radius: 8px; overflow-x: auto; margin: 0 0 16px; }
.article-content pre code { background: none; padding: 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 14px; display: block; overflow-x: auto; }
.article-content th, .article-content td { border: 1px solid var(--border-color); padding: 8px 10px; text-align: left; }
.article-content th { background: var(--bg-secondary); color: var(--text-main); }
.article-content hr { border: 0; border-top: 1px solid var(--border-color); margin: 24px 0; }
.article-content .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.article-content .alignleft { float: left; margin: 4px 18px 10px 0; }
.article-content .alignright { float: right; margin: 4px 0 10px 18px; }
.article-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.article-content::after { content: ""; display: table; clear: both; }
.article-content .wp-block-button__link { background: var(--brand-green); color: #fff; border-radius: 8px; padding: 9px 16px; text-decoration: none; display: inline-block; }

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.article-tags a { font-size: 12.5px; font-weight: 600; text-decoration: none; color: var(--brand-green); background: rgba(83, 85, 141, 0.12); border-radius: 20px; padding: 4px 11px; }

.article-try {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border-color); text-align: center;
}
.article-try .btn-calculate { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; width: auto; padding-left: 22px; padding-right: 22px; }

.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.article-nav a {
  display: block; text-decoration: none; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-main); font-size: 13.5px; font-weight: 600;
}
.article-nav a:hover { border-color: var(--brand-green); }
.article-nav small { display: block; color: var(--text-muted); font-weight: 600; font-size: 11.5px; margin-bottom: 3px; }
.article-nav .next { text-align: right; grid-column: 2; }

/* page links inside a long post (<!--nextpage-->) */
.page-links { margin: 18px 0; font-weight: 600; font-size: 13.5px; color: var(--text-main); }
.page-links a, .page-links > span:not(.page-links-title) { display: inline-block; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border-color); margin-left: 4px; text-decoration: none; color: var(--text-main); }

/* ---------- comments ---------- */
.comments-area { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border-color); text-align: left; }
.comments-title, .comment-reply-title { font-size: 18px; font-weight: 800; color: var(--text-main); margin-bottom: 14px; }
.comment-list { list-style: none; margin: 0 0 20px; padding: 0; }
.comment-list .children { list-style: none; margin-left: 22px; padding: 0; }
.comment-body { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; font-size: 14px; color: var(--text-muted); }
.comment-author { font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.comment-author img { border-radius: 50%; }
.comment-author .says { display: none; }
.comment-metadata, .comment-metadata a { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.comment-content p { margin: 8px 0 0; line-height: 1.6; }
.reply a { font-size: 12.5px; font-weight: 700; color: var(--brand-green); text-decoration: none; }
.comment-form p { margin-bottom: 12px; }
.comment-form label { display: block; font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; padding: 9px 12px; font-size: 14px; font-family: inherit; border-radius: 8px;
  border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-main);
}
.comment-form .comment-form-cookies-consent label { display: inline; font-weight: 400; }
.comment-form .submit { background: var(--brand-green); color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-weight: 700; cursor: pointer; font-family: inherit; }

/* screen-reader text (WordPress standard) */
.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 !important; width: 1px; word-wrap: normal !important; }
.screen-reader-text:focus { clip: auto !important; clip-path: none; display: block; height: auto; width: auto; z-index: 100000; background: var(--bg-card); padding: 10px 14px; }

/* the WordPress admin bar pushes the fixed header down */
body.admin-bar .navbar { top: 32px; }
@media (max-width: 782px) { body.admin-bar .navbar { top: 46px; } }

/* right-to-left languages chosen in the footer */
.lang-rtl .article-content p, .lang-rtl .article-content li { direction: rtl; text-align: right; }

@media (max-width: 600px) {
  .article-title { font-size: 21px; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav .next { grid-column: 1; text-align: left; }
}

/* Header buttons that are links on the blog (Recents, Login, signed-in name): same look as the main site's buttons */
.navbar a.mobile-menu-btn, .navbar a.btn-login, .navbar a.user-profile-btn { text-decoration: none; }
.navbar a.btn-login:hover, .navbar a.btn-login:focus { text-decoration: none; }
.btn-mobile-drawer-login { text-decoration: none; }
