/*
Theme Name: Adaptive Full Width
Theme URI: https://example.com/adaptive-full-width
Author: Grok
Author URI: https://x.ai
Description: 一个标准的 WordPress 主题，采用 100% 宽度自适应布局，完美支持移动端响应式设计。使用现代 Flexbox 布局，移动优先理念，纯 CSS 实现无障碍适配。
Version: 1.2.0
Requires at least: 5.0
Tested up to: 6.7
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: adaptive-full-width
Tags: full-width-template, responsive-layout, custom-menu, custom-logo, featured-images, blog, one-column, two-columns, right-sidebar, translation-ready, customizer
*/

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

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

body {
  width: 100%;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.6;
  color: #1a1a1a;
  background-color: #ffffff;
  overflow-x: hidden; /* 防止水平滚动 */
}

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

a {
  color: #0066cc;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: #004499;
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}

/* ==========================================================================
   2. Layout - 100% Width Full Adaptive
   ========================================================================== */
.site {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header - 全宽 */
.site-header {
  width: 100%;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-inner {
  width: 100%;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-branding {
  flex: 1 1 auto;
  min-width: 0;
}

.site-title {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

.site-title a {
  color: #1a1a1a;
  text-decoration: none;
}

.site-title a:hover {
  color: #0066cc;
  text-decoration: none;
}

.site-description {
  font-size: 0.875rem;
  color: #666;
  margin-top: 0.25rem;
}

/* Navigation */
.main-navigation {
  flex: 0 1 auto;
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
}

.nav-menu li {
  position: relative;
}

.nav-menu a {
  display: block;
  padding: 0.5rem 0;
  font-weight: 500;
  color: #333;
  text-decoration: none;
}

.nav-menu a:hover,
.nav-menu a:focus,
.nav-menu .current-menu-item > a {
  color: #0066cc;
}

/* Content Area - 100% Width Flex Layout */
.site-content {
  width: 100%;
  flex: 1 0 auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

.primary {
  flex: 1 1 0;
  min-width: 0; /* 防止 flex 子项溢出 */
  max-width: 100%;
}

.secondary {
  flex: 0 1 300px;
  min-width: 250px;
  max-width: 100%;
}

/* Footer - 全宽 */
.site-footer {
  width: 100%;
  background-color: #1a1a1a;
  color: #ccc;
  padding: 2rem 1.25rem;
  margin-top: auto;
}

.footer-inner {
  width: 100%;
  text-align: center;
  font-size: 0.875rem;
}

.footer-inner a {
  color: #fff;
}

/* ==========================================================================
   3. Content Styles
   ========================================================================== */
.entry {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #eee;
}

.entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.entry-header {
  margin-bottom: 1rem;
}

.entry-title {
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.entry-title a {
  color: #1a1a1a;
  text-decoration: none;
}

.entry-title a:hover {
  color: #0066cc;
}

.entry-meta {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 1rem;
}

.entry-content {
  font-size: 1rem;
  line-height: 1.75;
}

.entry-content p {
  margin-bottom: 1.25rem;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin: 1.75rem 0 1rem;
  line-height: 1.3;
}

.entry-content ul,
.entry-content ol {
  margin: 0 0 1.25rem 1.5rem;
  list-style: disc;
}

.entry-content ol {
  list-style: decimal;
}

.entry-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #0066cc;
  background: #f8f9fa;
  font-style: italic;
}

.entry-content pre {
  overflow-x: auto;
  padding: 1rem;
  background: #f4f4f4;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.entry-content code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f4f4f4;
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.entry-content pre code {
  background: none;
  padding: 0;
}

/* Post Navigation */
.posts-navigation,
.post-navigation {
  margin: 2rem 0;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.nav-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   4. Sidebar / Widgets
   ========================================================================== */
.widget {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.widget:last-child {
  margin-bottom: 0;
}

.widget-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #0066cc;
}

.widget ul {
  list-style: none;
}

.widget ul li {
  padding: 0.4rem 0;
  border-bottom: 1px solid #e5e5e5;
}

.widget ul li:last-child {
  border-bottom: none;
}

.widget a {
  color: #333;
}

.widget a:hover {
  color: #0066cc;
}

/* ==========================================================================
   5. Forms & Buttons
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

button,
.button,
input[type="submit"] {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  background-color: #0066cc;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
  background-color: #004499;
  color: #fff;
}

/* Search Form */
.search-form {
  display: flex;
  gap: 0.5rem;
}

.search-form .search-field {
  flex: 1;
}

/* ==========================================================================
   6. Comments
   ========================================================================== */
.comments-area {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

.comment-list {
  list-style: none;
  margin: 1.5rem 0;
}

.comment {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.comment-author {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.comment-meta {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   7. Accessibility & Utilities
   ========================================================================== */
.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;
  width: 1px;
  word-wrap: normal !important;
}

.alignleft {
  float: left;
  margin: 0 1.5rem 1rem 0;
}

.alignright {
  float: right;
  margin: 0 0 1rem 1.5rem;
}

.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.wp-caption {
  max-width: 100%;
}

.wp-caption-text {
  font-size: 0.875rem;
  color: #666;
  text-align: center;
  margin-top: 0.5rem;
}

/* ==========================================================================
   8. Responsive Design - Mobile First Breakpoints
   ========================================================================== */

/* Tablet and below (max-width: 992px) */
@media (max-width: 992px) {
  .secondary {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .site-content {
    gap: 1.5rem;
  }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }

  .main-navigation {
    width: 100%;
  }

  .nav-menu {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
  }

  .nav-menu li {
    width: 100%;
    border-bottom: 1px solid #eee;
  }

  .nav-menu a {
    padding: 0.75rem 0;
  }

  .site-content {
    padding: 1rem;
    flex-direction: column;
  }

  .primary,
  .secondary {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .entry-title {
    font-size: 1.375rem;
  }

  .alignleft,
  .alignright {
    float: none;
    margin: 0 0 1rem 0;
    display: block;
  }

  .nav-links {
    flex-direction: column;
  }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .header-inner,
  .site-content,
  .site-footer {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .widget {
    padding: 1rem;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .site-footer,
  .secondary,
  .nav-menu {
    display: none;
  }

  .primary {
    width: 100%;
  }

  body {
    font-size: 12pt;
    color: #000;
  }

  a {
    text-decoration: underline;
  }
}

/* ==========================================================================
   9. 主题开关相关样式（当关闭头部/底部/标题时）
   ========================================================================== */
body.no-header .site-content {
  /* 没有头部时，内容区顶部可减少一些间距（可选） */
  padding-top: 1.25rem;
}

body.no-footer .site-content {
  /* 没有底部时保持正常 */
}

body.no-titles .entry-header .entry-title,
body.no-titles .page-title {
  display: none;
}

/* 当标题关闭时，entry-meta 的上边距可微调 */
body.no-titles .entry-header .entry-meta {
  margin-top: 0;
}