/*
Theme Name:        My Framework
Theme URI:         https://example.com/my-framework
Author:            Your Name
Author URI:        https://example.com
Description:       A modern, clean, and extensible WordPress theme framework built with best practices. Supports Gutenberg blocks, customizer, dark mode, translation-ready, fully responsive, and Elementor ready – design pages visually through the Elementor editor.
Version:           1.1.0
Requires at least: 6.0
Tested up to:      6.7
Requires PHP:      8.0
License:           GNU General Public License v2 or later
License URI:       http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       my-framework
Tags:              custom-background, custom-logo, custom-menu, featured-image, threaded-comments, translation-ready, block-styles, responsive-layout
*/

/* ========== CSS Variables (Root Theme Configuration) ========== */
:root {
  /* Primary Colors */
  --color-primary:           #2563eb;
  --color-primary-dark:      #1d4ed8;
  --color-accent:            #f97316;

  /* Neutral Colors */
  --color-white:             #ffffff;
  --color-gray-50:           #f8fafc;
  --color-gray-100:          #f1f5f9;
  --color-gray-200:          #e2e8f0;
  --color-gray-300:          #cbd5e1;
  --color-gray-400:          #94a3b8;
  --color-gray-500:          #64748b;
  --color-gray-600:          #475569;
  --color-gray-700:          #334155;
  --color-gray-800:          #1e293b;
  --color-gray-900:          #0f172a;
  --color-black:             #000000;

  /* Semantic Colors */
  --color-text:              var(--color-gray-900);
  --color-text-muted:        var(--color-gray-500);
  --color-bg:                var(--color-white);
  --color-bg-alt:            var(--color-gray-50);
  --color-border:            var(--color-gray-200);

  /* Typography */
  --font-primary:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading:            'Poppins', var(--font-primary);
  --font-mono:               'Fira Code', 'Consolas', monospace;

  /* Font Sizes */
  --text-xs:                 0.75rem;
  --text-sm:                 0.875rem;
  --text-base:               1rem;
  --text-lg:                 1.125rem;
  --text-xl:                 1.25rem;
  --text-2xl:                1.5rem;
  --text-3xl:                1.875rem;
  --text-4xl:                2.25rem;

  /* Spacing */
  --space-1:                 0.25rem;
  --space-2:                 0.5rem;
  --space-3:                 0.75rem;
  --space-4:                 1rem;
  --space-6:                 1.5rem;
  --space-8:                 2rem;
  --space-12:                3rem;
  --space-16:                4rem;

  /* Sizing */
  --container-max:           1200px;
  --header-height:           4.5rem;

  /* Borders & Shadows */
  --radius-sm:               4px;
  --radius-md:               8px;
  --radius-lg:               12px;
  --shadow-sm:               0 1px 2px rgba(0,0,0,.05);
  --shadow-md:               0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg:               0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);

  /* Transitions */
  --transition-base:         200ms ease;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text:       var(--color-gray-100);
    --color-bg:         var(--color-gray-900);
    --color-bg-alt:     var(--color-gray-800);
    --color-border:     var(--color-gray-700);
  }
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
}

img, video, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}
a:hover { color: var(--color-primary-dark); }

/* ========== Utility Classes ========== */
.container      { width: 100%; max-width: var(--container-max); margin-inline: auto; padding-inline: var(--space-4); }
.container-sm   { max-width: 960px; }
.container-lg   { max-width: 1400px; }
.sr-only         { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center     { text-align: center; }
.mt-4            { margin-top: var(--space-4); }
.mb-4            { margin-bottom: var(--space-4); }

/* ========== Skip to Content Link (Accessibility) ========== */
.skip-link {
  position: absolute; top: var(--space-2); left: var(--space-2);
  z-index: 100000; padding: var(--space-2) var(--space-4);
  background: var(--color-primary); color: #fff; border-radius: var(--radius-sm);
  opacity: 0; pointer-events: none; transition: opacity var(--transition-base);
}
.skip-link:focus { opacity: 1; }

/* ========== Header Component ========== */
.site-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(var(--header-height) + var(--space-2));
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand__logo a { display: inline-block; }
.brand__text {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
}
.brand__tagline {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

main-nav { flex: 1; display: flex; justify-content: flex-end; }
.main-nav__list {
  display: flex;
  list-style: none;
  gap: var(--space-6);
  align-items: center;
}

.main-nav__list a {
  font-weight: 500;
  color: var(--color-text);
}
.main-nav__list a:hover { color: var(--color-primary); }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
}
.menu-toggle__lines {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  position: relative;
  box-shadow: 0 -6px 0 var(--color-text), 0 6px 0 var(--color-text);
}

/* Site Header Scrolled State */
.site-header.is-scrolled {
  box-shadow: var(--shadow-md);
}
.site-header.going-down {
  transform: translateY(-100%);
}

/* ===== Grid & Layout ===== */
.grid-3-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
}

.layout-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-8);
  padding: var(--space-8) 0;
}
.content-no-sidebar { grid-column: 1; grid-column-end: -1; }

@media (max-width: 768px) {
  .layout-content { grid-template-columns: 1fr; }
  .site-header__inner { height: auto; padding: var(--space-4) 0; }
  .menu-toggle { display: block; }
  .main-nav__list {
    position: fixed;
    right: -999px;
    top: var(--header-height);
    flex-direction: column;
    background: var(--color-bg);
    width: 100%;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    transition: right 0.3s ease;
  }
  .main-nav__list.is-open { right: 0; }
  .main-nav__list li { border-top: 1px solid var(--color-border); }
  body.no-scroll { overflow: hidden; }
}

/* ===== Page Hero & Sections ===== */
.hero-banner {
  padding: var(--space-16) var(--space-4);
  text-align: center;
  background: linear-gradient(180deg, var(--color-bg), var(--color-bg-alt));
}
.hero-title {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
}
.hero-subtitle { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 600px; margin-inline: auto; }

.section-header { margin-bottom: var(--space-8); }
.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}
.section-description { color: var(--color-text-muted); }

.archive-hero {
  padding: var(--space-12) 0;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
}
.archive-description { margin-top: var(--space-4); color: var(--color-text-muted); }

/* ===== Post Cards & Blog ===== */
.posts { display: grid; gap: var(--space-8); }
.posts--grid .post-card {
  display: flex;
  flex-direction: column;
}
.posts--list .post-card { display: grid; grid-template-columns: 1fr; gap: var(--space-4); padding: var(--space-6); background: var(--color-bg-alt); border-radius: var(--radius-md); }

.post-card {
  display: flex;
  flex-direction: row;
  gap: var(--space-6);
  padding: var(--space-6);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.post-card__image { flex-shrink: 0; }
.post-card__thumb {
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.post-card__body { flex: 1; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  margin-right: var(--space-2);
  vertical-align: middle;
}
.post-card__categories { margin-bottom: var(--space-2); }
.post-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}
.post-card__title a { color: inherit; }
.post-card__excerpt { font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.6; }

.post-card__meta {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}
.post-card__link {
  font-weight: 600;
  color: var(--color-primary);
}

.post-card--excerpt-only .post-card__thumb-inline { flex-shrink: 0; margin-right: var(--space-4); }
.post-card--excerpt-only .post-card__thumb-thumb { width: 80px; height: 60px; }
.post-card--excerpt-only .post-card__meta { gap: var(--space-2); }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-align: center;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff !important;
}
.btn--primary:hover { background: var(--color-primary-dark); }

/* ===== Sidebar ===== */
.sidebar .widget {
  padding: var(--space-6);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.widget-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

/* ===== Footer ===== */
.site-footer {
  background: var(--color-gray-800);
  color: var(--color-gray-400);
  border-top: 1px solid var(--color-gray-700);
  flex: 0 0 auto;
}
.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-footer__widgets {
  padding: var(--space-12) 0;
  border-bottom: 1px solid var(--color-gray-700);
}
.site-footer__columns { display: grid; gap: var(--space-8); }
.site-footer__column .widget-title { color: #fff; }
.site-footer__column .widget {
  padding: var(--space-6);
  background: var(--color-gray-800);
  color: var(--color-gray-400);
  margin-bottom: 0;
}
.site-footer__column .widget a { color: var(--color-gray-300); }
.site-footer__column .widget a:hover { color: #fff; }

.site-footer__bar {
  padding: var(--space-6) 0;
}
.site-footer__copyright, .site-footer__menu, .site-footer__top { margin: 0; }
.site-footer__menu {
  display: flex;
  list-style: none;
  gap: var(--space-6);
}
.site-footer__top { color: var(--color-gray-400); text-decoration: underline; }
.site-footer__top:hover { color: #fff; }

/* ===== Page Template ===== */
.page__hero-image { margin-bottom: var(--space-6); }
.page__thumb { width: 100%; margin: 0; }
.page__title { font-family: var(--font-heading); font-size: var(--text-3xl); margin: var(--space-4) 0; }
.page__content { margin-top: var(--space-6); }

/* ===== Post Card Single ===== */
.single-post {
  max-width: 900px;
  margin: var(--space-8) auto;
  padding: var(--space-6);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.breadcrumbs ul {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.single-post__meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.single-post__title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  margin: var(--space-4) 0;
}
.single-post__featured-image { margin-top: var(--space-6); }
.single-post__thumb { width: 100%; border-radius: var(--radius-md); }
.single-post__content { margin-top: var(--space-6); }
.single-post__footer { margin-top: var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--color-border); }
.single-post__tags { font-size: var(--text-sm); }
.single-post__tags-label { font-weight: 600; }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-8);
}
.pagination .page-numbers {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.pagination .page-numbers:hover, .pagination .page-numbers.current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ===== Search Forms ===== */
.search-form-inline {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}
.search-form-inline input {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-width: 200px;
  font-size: var(--text-base);
}
.search-form-inline button {
  padding: var(--space-2) var(--space-6);
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.search-form-inline button:hover { background: var(--color-primary-dark); }

/* ===== Comments ===== */
.comments-area {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border);
}
.comments-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-6);
}
.comment-list { list-style: none; padding: 0; }
.comment-list .comment {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-2);
}
.comment-list .comment__author { font-weight: 600; }
.comment-list .comment__author a { color: inherit; }
.comment-body { font-size: var(--text-base); }
.comment__date { font-size: var(--text-sm); color: var(--color-text-muted); }
.comment-reply-link { font-size: var(--text-sm); font-weight: 600; }

.comment-form {
  padding-top: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ===== Comments Form ===== */
.comment-form input, .comment-form textarea {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.comment-form p { margin: 0; }
.comment-form label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

/* ===== Error 404 ===== */
.error-page {
  padding: var(--space-16) 0;
}
.error-page__illustration {
  margin-bottom: var(--space-6);
}
.error-page__illustration svg {
  stroke: var(--color-primary);
  opacity: 0.8;
}
.error-page__title {
  font-family: var(--font-heading);
  font-size: var(--text-6xl);
  line-height: 1;
  margin-bottom: var(--space-6);
  color: var(--color-gray-700);
}
.error-page__message {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 400px;
  margin-inline: auto;
  margin-bottom: var(--space-8);
}
.error-page__actions { display: flex; flex-wrap: wrap; gap: var(--space-6); justify-content: center; }

/* ===== No Results ===== */
.no-results, .no-posts {
  padding: var(--space-8) var(--space-6);
  text-align: center;
  background: var(--color-bg-alt);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border);
}
.no-results h2, .no-posts h2 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}
.no-results p, .no-posts p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

/* ===== Gutenberg Block Support ===== */
.wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
}
.wp-block-button__link {
  display: inline-block;
  background: var(--color-primary) !important;
  color: #fff !important;
  padding: var(--space-3) var(--space-6) !important;
  border-radius: var(--radius-sm);
  font-weight: 600 !important;
  transition: background 0.2s;
}
.wp-block-button__link:hover { background: var(--color-primary-dark) !important; }
.wp-block-separator.has-large-border-width {
  border-top-width: 4px !important;
}

/* ===== Responsive Breakpoints ===== */
@media (max-width: 768px) {
  .hero-title { font-size: var(--text-2xl); }
  .post-card { flex-direction: column; }
  .post-card__thumb { width: 100%; height: auto; }
  .site-footer__inner { flex-direction: column; gap: var(--space-6); }
  .site-footer__menu { flex-direction: column; gap: var(--space-2); }
}

@media (min-width: 1400px) {
  :root { --container-max: 1600px; }
}
