/*
Theme Name: Quill Magazine
Theme URI: https://example.com/quill-magazine
Author: Your Name
Author URI: https://example.com
Description: A clean, full-featured magazine-style blog theme with featured post sections, popular posts widget, breadcrumbs, reading time, related posts, custom widget areas and a custom Testimonials post type. Inspired by the layout conventions of magazine/blog themes like Kreeti Lite.
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.6
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: quill-magazine
Tags: blog, news, one-column, two-columns, right-sidebar, left-sidebar, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready, footer-widgets, full-width-template, theme-options
*/

/* =========================================================
   0. CSS VARIABLES (edited live by Customizer inline styles)
   ========================================================= */
:root {
  --qm-accent: #d9482b;
  --qm-dark: #1a1a1a;
  --qm-text: #333333;
  --qm-muted: #6b6b6b;
  --qm-border: #e5e5e5;
  --qm-bg: #ffffff;
  --qm-bg-alt: #f7f6f4;
  --qm-font-heading: 'Georgia', 'Times New Roman', serif;
  --qm-font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --qm-radius: 4px;
  --qm-container: 1200px;
}

/* =========================================================
   1. RESET / BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--qm-font-body);
  color: var(--qm-text);
  background: var(--qm-bg);
  font-size: 17px;
  line-height: 1.7;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--qm-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--qm-font-heading);
  color: var(--qm-dark);
  line-height: 1.25;
  margin: 0 0 .5em;
}
ul, ol { padding-left: 1.2em; }
figure { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 1em; }

.container {
  max-width: var(--qm-container);
  margin: 0 auto;
  padding: 0 20px;
}
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px,1px,1px,1px);
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--qm-dark);
  color: #fff;
  padding: 10px 16px;
  z-index: 10000;
}
.skip-link:focus { left: 10px; top: 10px; }

/* =========================================================
   2. SITE HEADER
   ========================================================= */
.site-topbar {
  background: var(--qm-dark);
  color: #cfcfcf;
  font-size: 13px;
}
.site-topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
}
.site-topbar a { color: #fff; }
.social-links { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; }

.site-header {
  border-bottom: 1px solid var(--qm-border);
  padding: 22px 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.site-branding { display: flex; align-items: center; gap: 14px; }
.site-title {
  font-size: 30px;
  margin: 0;
  letter-spacing: -0.5px;
}
.site-title a { color: var(--qm-dark); }
.site-description {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--qm-muted);
  font-family: var(--qm-font-body);
}
.custom-logo { max-height: 60px; width: auto; }

/* Primary nav */
.main-navigation { position: relative; }
.main-navigation ul {
  list-style: none;
  display: flex;
  gap: 26px;
  margin: 0;
  padding: 0;
}
.main-navigation li { position: relative; }
.main-navigation a {
  color: var(--qm-dark);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: block;
  padding: 6px 0;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a { color: var(--qm-accent); text-decoration: none; }
.main-navigation .sub-menu {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  background: #fff;
  border: 1px solid var(--qm-border);
  min-width: 200px;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  z-index: 50;
}
.main-navigation li:hover > .sub-menu { display: flex; }
.main-navigation .sub-menu a { padding: 8px 16px; text-transform: none; font-weight: 400; }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--qm-border);
  border-radius: var(--qm-radius);
  padding: 8px 10px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--qm-dark);
  margin: 4px 0;
}

/* Off-canvas mobile menu */
.mobile-drawer {
  position: fixed;
  top: 0; right: -320px;
  width: 300px; height: 100%;
  background: #fff;
  box-shadow: -6px 0 24px rgba(0,0,0,.15);
  transition: right .3s ease;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}
.mobile-drawer.is-open { right: 0; }
.mobile-drawer-close {
  background: none; border: 0; font-size: 26px; line-height: 1;
  float: right; cursor: pointer;
}
.mobile-drawer ul { list-style: none; padding: 0; margin: 40px 0 0; }
.mobile-drawer li { border-bottom: 1px solid var(--qm-border); }
.mobile-drawer a { display: block; padding: 12px 0; color: var(--qm-dark); font-weight: 600; }
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  opacity: 0; visibility: hidden; transition: opacity .3s ease;
  z-index: 999;
}
.drawer-overlay.is-visible { opacity: 1; visibility: visible; }

/* =========================================================
   3. LAYOUT: CONTENT + SIDEBAR
   ========================================================= */
.site-content { padding: 40px 0; }
.content-area.has-sidebar {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: start;
}
.content-area.full-width { display: block; }

/* =========================================================
   4. HOMEPAGE / FRONT PAGE MAGAZINE SECTIONS
   ========================================================= */
.section-title {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 3px solid var(--qm-dark);
  padding-bottom: 10px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title span.accent { color: var(--qm-accent); }

.featured-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 50px;
}
.featured-main {
  position: relative;
  border-radius: var(--qm-radius);
  overflow: hidden;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
  color: #fff;
}
.featured-main::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.85) 100%);
}
.featured-main .featured-content { position: relative; padding: 30px; z-index: 2; }
.featured-main .cat-badge { background: var(--qm-accent); color: #fff; }
.featured-main h2 { color: #fff; font-size: 28px; margin: 10px 0; }
.featured-main h2 a { color: #fff; }
.featured-main .entry-meta { color: #eee; }

.featured-side { display: flex; flex-direction: column; gap: 18px; }
.featured-side-item { display: flex; gap: 14px; }
.featured-side-item .thumb {
  width: 110px; height: 80px; flex: none; border-radius: var(--qm-radius); overflow: hidden;
}
.featured-side-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.featured-side-item h3 { font-size: 15px; margin: 0 0 6px; }

.cat-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--qm-bg-alt);
  color: var(--qm-accent);
  padding: 3px 9px;
  border-radius: 2px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 50px;
}
.post-card .thumb { border-radius: var(--qm-radius); overflow: hidden; margin-bottom: 14px; aspect-ratio: 16/10; }
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.post-card:hover .thumb img { transform: scale(1.05); }
.post-card h3 { font-size: 18px; margin: 10px 0 8px; }
.post-card .excerpt { color: var(--qm-muted); font-size: 15px; }

.entry-meta {
  font-size: 13px;
  color: var(--qm-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.entry-meta a { color: inherit; }
.reading-time::before { content: "\2022"; margin-right: 10px; }

/* =========================================================
   5. SINGLE POST / PAGE
   ========================================================= */
.breadcrumbs { font-size: 13px; color: var(--qm-muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--qm-muted); }
.entry-header { margin-bottom: 20px; }
.entry-title { font-size: 34px; margin: 12px 0; }
.entry-thumbnail { margin-bottom: 24px; border-radius: var(--qm-radius); overflow: hidden; }
.entry-content { font-size: 18px; }
.entry-content p { margin: 0 0 1.4em; }
.entry-content h2, .entry-content h3 { margin-top: 1.6em; }
.entry-content blockquote {
  border-left: 4px solid var(--qm-accent);
  margin: 1.6em 0;
  padding: .4em 1.4em;
  font-style: italic;
  color: var(--qm-muted);
  background: var(--qm-bg-alt);
}
.entry-tags { margin: 30px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.entry-tags a {
  background: var(--qm-bg-alt);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--qm-text);
}
.author-box {
  display: flex; gap: 18px;
  background: var(--qm-bg-alt);
  padding: 24px;
  border-radius: var(--qm-radius);
  margin: 40px 0;
}
.author-box img { border-radius: 50%; width: 70px; height: 70px; }
.author-box h4 { margin: 0 0 6px; }

.related-posts { margin: 50px 0; }
.related-posts .posts-grid { grid-template-columns: repeat(3, 1fr); margin-bottom: 0; }

.post-navigation {
  display: flex; justify-content: space-between; gap: 20px;
  border-top: 1px solid var(--qm-border);
  padding-top: 20px; margin-top: 30px;
}
.post-navigation .nav-label { display: block; font-size: 12px; color: var(--qm-muted); text-transform: uppercase; }

/* =========================================================
   6. WIDGETS / SIDEBAR
   ========================================================= */
.widget { margin-bottom: 40px; }
.widget-title {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--qm-dark);
  padding-bottom: 10px;
  margin-bottom: 18px;
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { margin-bottom: 12px; }

.popular-posts-widget .pp-item { display: flex; gap: 12px; margin-bottom: 16px; }
.popular-posts-widget .pp-item .thumb { width: 70px; height: 70px; flex: none; border-radius: var(--qm-radius); overflow: hidden; }
.popular-posts-widget .pp-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.popular-posts-widget .pp-item h4 { font-size: 14px; margin: 0 0 4px; }

/* =========================================================
   7. FOOTER
   ========================================================= */
.site-footer {
  background: var(--qm-dark);
  color: #cfcfcf;
  padding: 50px 0 20px;
  margin-top: 40px;
}
.footer-widgets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 30px;
}
.site-footer .widget-title { color: #fff; border-bottom-color: rgba(255,255,255,.25); }
.site-footer a { color: #cfcfcf; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 20px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* =========================================================
   8. PAGINATION / COMMENTS / MISC
   ========================================================= */
.pagination { display: flex; gap: 8px; margin: 30px 0; list-style: none; padding: 0; }
.pagination a, .pagination span {
  display: inline-block; padding: 8px 14px;
  border: 1px solid var(--qm-border); border-radius: var(--qm-radius);
  color: var(--qm-text);
}
.pagination .current { background: var(--qm-dark); color: #fff; border-color: var(--qm-dark); }

.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-body { border-bottom: 1px solid var(--qm-border); padding: 20px 0; }
.comment-form input, .comment-form textarea {
  width: 100%; padding: 10px; border: 1px solid var(--qm-border); border-radius: var(--qm-radius); margin-bottom: 14px;
}
.comment-form .form-submit input {
  width: auto; background: var(--qm-accent); color: #fff; border: none; padding: 10px 22px; font-weight: 600;
}

.testimonial-card {
  background: var(--qm-bg-alt); border-radius: var(--qm-radius); padding: 24px; margin-bottom: 20px;
}
.testimonial-card .stars { color: #f5a623; margin-bottom: 10px; }

/* =========================================================
   9. RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .content-area.has-sidebar { grid-template-columns: 1fr; }
  .featured-grid { grid-template-columns: 1fr; }
  .posts-grid, .related-posts .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-widgets { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .main-navigation { display: none; }
  .menu-toggle { display: inline-flex; align-items: center; }
  .posts-grid, .related-posts .posts-grid { grid-template-columns: 1fr; }
  .footer-widgets { grid-template-columns: 1fr; }
  .entry-title { font-size: 26px; }
  .site-header .container { justify-content: space-between; }
}
