/*
Theme Name: Al Muslim Hindi
Theme URI: https://almuslim-hindi.in
Author: Mohd Asim Raza
Description: Lightweight custom theme for Al Muslim Hindi - Islamic content, Naat, Dua and Tabeer publishing. Cream/ink-teal/gold manuscript inspired design.
Version: 1.7
Requires PHP: 7.4
Text Domain: almuslim
*/

/* ==========================================================================
   0. RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ap-bg);
  color: var(--ap-text);
  font-family: 'Inter', 'Noto Sans Devanagari', sans-serif;
  font-size: 15px;
}
img { max-width: 100%; height: auto; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
a { text-decoration: none; }

/* ==========================================================================
   1. COLOR / TOKENS
   ========================================================================== */
:root {
  --ap-bg: #FAF6EE;
  --ap-ink: #16302B;
  --ap-ink-dark: #0F241F;
  --ap-on-ink: #FAF6EE;
  --ap-gold: #C9A24B;
  --ap-gold-dark: #8A6B2E;
  --ap-border: #E5DCC3;
  --ap-card-tint: #EDE3D0;
  --ap-card-bg: #FFFFFF;
  --ap-heading: #16302B;
  --ap-text: #3A3528;
  --ap-text-muted: #A39C87;
  --ap-container: 1080px;
}

[data-theme="dark"] {
  --ap-bg: #16211D;
  --ap-gold: #D9B876;
  --ap-gold-dark: #D9B876;
  --ap-border: #2B362F;
  --ap-card-tint: #223028;
  --ap-card-bg: #1C2823;
  --ap-heading: #F1ECDF;
  --ap-text: #D8D3C4;
  --ap-text-muted: #8B9089;
}

body { transition: background 0.25s ease, color 0.25s ease; }

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

h1, h2, h3, h4, h5 {
  font-family: 'Amiri', 'Noto Sans Devanagari', serif;
  color: var(--ap-heading);
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 12px;
}
p { line-height: 1.75; margin: 0 0 11px; }
a { color: var(--ap-gold-dark); }
a:hover { color: var(--ap-heading); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--ap-gold);
  outline-offset: 2px;
}

/* ==========================================================================
   2. HEADER
   ========================================================================== */
.site-header {
  background: var(--ap-ink);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  padding-bottom: 8px;
}
.site-branding {
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-branding img.custom-logo {
  max-height: 28px;
  width: auto;
}
.site-branding .site-title {
  margin: 0;
  font-size: 17px;
}
.site-branding .site-title a {
  color: var(--ap-on-ink);
  font-family: 'Amiri', serif;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.desktop-nav ul {
  display: flex;
  gap: 26px;
  align-items: center;
}
.desktop-nav a {
  color: #D8CFB8;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  padding-bottom: 3px;
}
.desktop-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0;
  height: 1px;
  background: var(--ap-gold);
  transition: width 0.2s ease;
}
.desktop-nav a:hover { color: var(--ap-gold); }
.desktop-nav a:hover::after { width: 100%; }

.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: var(--ap-on-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ap-gold); color: var(--ap-gold); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--ap-on-ink);
  cursor: pointer;
  padding: 4px;
}

.header-strip {
  height: 6px;
  background: var(--ap-ink-dark);
  background-image: repeating-linear-gradient(-45deg, var(--ap-gold) 0px, var(--ap-gold) 2px, transparent 2px, transparent 14px);
  opacity: 0.5;
}

/* ---- Off-canvas mobile nav ---- */
.offcanvas-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 190;
}
.offcanvas-overlay.active { opacity: 1; pointer-events: auto; }

.offcanvas-nav {
  position: fixed;
  top: 0; right: -240px;
  width: 220px;
  max-width: 75vw;
  height: 100%;
  background: var(--ap-ink);
  z-index: 200;
  padding: 55px 22px 22px;
  transition: right 0.3s ease;
}
.offcanvas-nav.active { right: 0; }
.offcanvas-nav ul {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.offcanvas-nav a {
  color: #D8CFB8;
  font-size: 15px;
  font-weight: 500;
}
.offcanvas-nav a:hover { color: var(--ap-gold); }
.offcanvas-close {
  position: absolute;
  top: 16px; right: 18px;
  background: none;
  border: none;
  color: var(--ap-on-ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 640px) {
  .desktop-nav { display: none; }
  .nav-toggle { display: flex; }
}
@media (min-width: 641px) {
  .offcanvas-nav, .offcanvas-overlay { display: none; }
}

/* ==========================================================================
   3. LAYOUT / CONTENT GRID
   ========================================================================== */
.content-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  padding: 30px 0 50px;
}
.content-wrap.no-sidebar { grid-template-columns: 1fr; }
.main-content { min-width: 0; }

/* ==========================================================================
   4. POST CARDS (archive / homepage / search)
   ========================================================================== */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.post-card {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(22,48,43,0.05);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.post-card:hover {
  box-shadow: 0 6px 18px rgba(22,48,43,0.08);
  transform: translateY(-2px);
}
.post-card .post-thumb {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  aspect-ratio: 16 / 9;
}
.post-card .post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-card .badge {
  display: inline-block;
  background: var(--ap-card-tint);
  color: var(--ap-gold-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.post-card h2 {
  font-size: 21px;
  margin-bottom: 8px;
}
.post-card h2 a { color: var(--ap-heading); }
.post-card .post-meta {
  font-size: 12px;
  color: var(--ap-text-muted);
  margin-bottom: 10px;
}
.post-card .post-excerpt {
  color: var(--ap-text);
  font-size: 14.5px;
  margin-bottom: 12px;
}
.read-more-btn {
  display: inline-block;
  background: var(--ap-ink);
  color: var(--ap-on-ink) !important;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 20px;
}
.read-more-btn:hover { background: var(--ap-gold-dark); }

/* ==========================================================================
   5. SINGLE POST
   ========================================================================== */
.single-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
  margin-bottom: 22px;
}
.single-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.single-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,36,31,0.88), rgba(15,36,31,0.05));
}
.single-hero .hero-text {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 26px;
}
.single-hero .badge {
  background: var(--ap-gold);
  color: #3D2E0A;
}
.single-hero h1 {
  color: var(--ap-on-ink);
  font-size: 26px;
  margin: 8px 0 0;
}
.single .entry-title {
  font-size: 26px;
}
.single .post-meta {
  color: var(--ap-text-muted);
  font-size: 12.5px;
  margin-bottom: 18px;
}
.entry-content { font-size: 15px; }
.entry-content p {
  line-height: 1.6;
  margin: 0 0 10px;
}

.entry-content h2, .entry-content h3 {
  position: relative;
  padding-bottom: 10px;
  margin-top: 30px;
}
.entry-content h2::after, .entry-content h3::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 40px;
  height: 3px;
  background: var(--ap-gold);
  border-radius: 2px;
}

.entry-content ul, .entry-content ol {
  margin: 0 0 18px;
  padding-left: 4px;
}
.entry-content ul li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  list-style: none;
}
.entry-content ul li::before {
  content: "";
  position: absolute;
  left: 4px; top: 9px;
  width: 6px; height: 6px;
  background: var(--ap-gold);
  border-radius: 50%;
}
.entry-content ol {
  counter-reset: ap-counter;
  padding-left: 0;
}
.entry-content ol li {
  counter-increment: ap-counter;
  position: relative;
  padding-left: 30px;
  margin-bottom: 10px;
  list-style: none;
}
.entry-content ol li::before {
  content: counter(ap-counter);
  position: absolute;
  left: 0; top: 0;
  width: 20px; height: 20px;
  background: var(--ap-card-tint);
  color: var(--ap-gold-dark);
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-separator {
  height: 1px;
  background: var(--ap-border);
  margin: 0 0 24px;
  position: relative;
}
.title-separator::after {
  content: "\2726";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--ap-bg);
  color: var(--ap-gold);
  padding: 0 12px;
  font-size: 13px;
}

.entry-content hr {
  border: none;
  height: 1px;
  background: var(--ap-border);
  margin: 30px 0;
  position: relative;
}
.entry-content hr::after {
  content: "\2726";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--ap-bg);
  color: var(--ap-gold);
  padding: 0 12px;
  font-size: 13px;
}
.entry-content blockquote {
  position: relative;
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  padding: 24px 26px;
  margin: 24px 0;
  text-align: center;
}
.entry-content blockquote p {
  font-style: italic;
  color: var(--ap-heading);
  font-size: 15.5px;
  margin-bottom: 8px;
}
.entry-content blockquote cite {
  font-size: 12px;
  color: var(--ap-gold-dark);
  font-weight: 500;
  font-style: normal;
}
.entry-content blockquote::before,
.entry-content blockquote::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ap-gold);
  opacity: 0.55;
}
.entry-content blockquote::before { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.entry-content blockquote::after { bottom: 8px; right: 8px; border-left: none; border-top: none; }

/* related posts under single */
.related-section { margin-top: 34px; }
.related-section .section-label {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.related-section .section-label span {
  font-size: 12px; color: var(--ap-text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 500;
}
.related-section .section-label .line { flex: 1; height: 1px; background: var(--ap-border); }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.related-grid .post-card { padding: 0; overflow: hidden; }
.related-grid .post-card .post-thumb { margin: 0; border-radius: 0; aspect-ratio: 16 / 9; }
.related-grid .post-card .post-thumb img { height: 100%; }
.related-grid .post-card .card-body { padding: 12px; }
.related-grid .post-card h3 {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 13px; font-weight: 500; margin: 0 0 8px;
}
.related-grid .post-card .post-meta { font-size: 11px; margin: 0; }

/* ==========================================================================
   6. SIDEBAR
   ========================================================================== */
.sidebar .widget {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.sidebar .widget-title {
  font-size: 15px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ap-border);
}
.sidebar .mini-post {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.sidebar .mini-post:hover { border-color: var(--ap-gold); background: var(--ap-card-tint); }
.sidebar .mini-post:last-child { margin-bottom: 0; }
.sidebar .mini-thumb {
  width: 52px; height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ap-card-tint);
  color: var(--ap-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar .mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sidebar .mini-title {
  font-size: 13px;
  color: var(--ap-heading);
  line-height: 1.5;
}

/* ==========================================================================
   7. COMMENTS
   ========================================================================== */
.comments-area { margin-top: 34px; }
.comments-area > h3 {
  font-size: 18px;
  margin-bottom: 18px;
}

.comment-list, .comment-list ul.children {
  list-style: none;
  margin: 0; padding: 0;
}
.comment-list ul.children {
  margin-top: 16px;
  padding-left: 26px;
  border-left: 2px solid var(--ap-border);
}

.comment-list > li,
.comment-list li li {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.comment-list .comment-body { position: relative; }
.comment-list .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  float: left;
  margin-right: 12px;
  border: 1px solid var(--ap-border);
}
.comment-author {
  font-weight: 500;
  color: var(--ap-heading);
  font-size: 14px;
}
.comment-author .says { display: none; }
.comment-metadata {
  font-size: 11.5px;
  color: var(--ap-text-muted);
  margin-bottom: 10px;
}
.comment-metadata a { color: var(--ap-text-muted); }
.comment-edit-link {
  margin-left: 6px;
  font-size: 11px;
  color: var(--ap-gold-dark);
}
.comment-list .comment-content p {
  font-size: 14px;
  color: var(--ap-text);
  margin-bottom: 8px;
}
.comment-reply-link {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ap-gold-dark);
  border: 1px solid var(--ap-border);
  padding: 5px 14px;
  border-radius: 20px;
  margin-top: 4px;
}
.comment-reply-link:hover {
  background: var(--ap-card-tint);
  color: var(--ap-ink);
}

.ap-comment-form {
  background: var(--ap-card-bg);
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  padding: 22px;
  margin-top: 20px;
}
.ap-comment-form .comment-reply-title {
  font-size: 17px;
  margin-bottom: 14px;
}
#commentform input[type="text"],
#commentform input[type="email"],
#commentform input[type="url"],
#commentform textarea {
  background: var(--ap-bg);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  width: 100%;
  margin-bottom: 12px;
  color: var(--ap-text);
}
#commentform input:focus, #commentform textarea:focus {
  outline: none;
  border-color: var(--ap-gold);
}
#commentform input[type="submit"] {
  border: none;
  cursor: pointer;
}

/* ==========================================================================
   8. PAGINATION
   ========================================================================== */
.pagination {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}
.pagination a, .pagination span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ap-heading);
}
.pagination .current {
  background: var(--ap-ink);
  color: var(--ap-on-ink);
  border-color: var(--ap-ink);
}

/* ==========================================================================
   9. FOOTER
   ========================================================================== */
.footer-strip {
  height: 6px;
  background: var(--ap-ink-dark);
  background-image: repeating-linear-gradient(-45deg, var(--ap-gold) 0px, var(--ap-gold) 2px, transparent 2px, transparent 14px);
  opacity: 0.5;
}
.site-footer {
  background: var(--ap-ink-dark);
  padding: 40px 0 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1.4fr 1fr;
  gap: 32px;
  margin-bottom: 30px;
}
.footer-col + .footer-col {
  border-left: 1px solid rgba(255,255,255,0.08);
  padding-left: 32px;
}
.footer-logo {
  font-family: 'Amiri', serif;
  font-size: 19px;
  color: var(--ap-on-ink);
  margin-bottom: 10px;
}
.footer-about {
  font-size: 13px;
  color: #8FA39C;
  line-height: 1.8;
  margin: 0;
}
.footer-col .widget-title {
  color: var(--ap-gold);
  font-size: 14px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0; padding: 0;
}
.footer-categories li { margin: 0; }
.footer-categories a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: #B8C4BE;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.footer-categories a:hover {
  border-color: var(--ap-gold);
  color: var(--ap-gold);
}
.footer-categories .cat-count {
  color: var(--ap-gold);
  font-size: 11px;
  opacity: 0.75;
}

.footer-links {
  list-style: none;
  margin: 0; padding: 0;
}
.footer-links li { margin-bottom: 10px; }
.footer-links a {
  color: #8FA39C;
  font-size: 13px;
}
.footer-links a::before {
  content: "\2192";
  color: var(--ap-gold);
  margin-right: 8px;
}

.site-footer a:hover { color: var(--ap-gold); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 16px;
  text-align: center;
  font-size: 12px;
  color: #6E8079;
}

/* ==========================================================================
   10. RESPONSIVE
   ========================================================================== */
@media (max-width: 860px) {
  .content-wrap { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .footer-col + .footer-col { border-left: none; padding-left: 0; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 20px; }
}
@media (max-width: 640px) {
  .single .entry-title, .single-hero h1 { font-size: 22px; }
}
