/*
Theme Name: CodingFan Blog
Theme URI: https://codingfan.blog
Author: CodingFan
Author URI: https://codingfan.blog
Description: CodingFan Blog - モダンなブログテーマ。Noto Sans JP フォント、シアンアクセントカラー、レスポンシブデザイン対応。
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: codingfan
Tags: blog, two-columns, custom-menu, featured-images, translation-ready
*/

/* ============================================
   CSS Variables
   ============================================ */
:root {
  --primary-color: #333;
  --accent-color: #00bcd4;
  --text-color: #333;
  --text-light: #777;
  --bg-color: #f4f5f7;
  --white: #ffffff;
  --border-color: #e5e5e5;
  --font-base: 'Noto Sans JP', 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  --max-width: 1200px;
  --header-height: 80px;
}

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

body {
  font-family: var(--font-base);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-color);
}

ul {
  list-style: none;
}

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

/* ============================================
   Header
   ============================================ */
.site-header {
  background-color: var(--white);
  height: var(--header-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
}

.site-logo a {
  color: var(--primary-color);
}

.site-logo a:hover {
  color: var(--accent-color);
}

.main-nav ul {
  display: flex;
  gap: 30px;
}

.main-nav li {
  list-style: none;
}

.main-nav a {
  font-weight: 500;
  font-size: 15px;
  position: relative;
  padding: 5px 0;
}

.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: width 0.3s;
}

.main-nav a:hover::after,
.main-nav .current-menu-item a::after,
.main-nav .current-cat a::after,
.main-nav .current-menu-ancestor a::after {
  width: 100%;
}

.hamburger {
  display: none;
  cursor: pointer;
  font-size: 28px;
  color: var(--primary-color);
  background: none;
  border: none;
  line-height: 1;
}

/* ============================================
   Hero Section (Front Page)
   ============================================ */
.hero {
  background: linear-gradient(135deg, #ffffff 0%, #e8f5f7 100%);
  padding: 80px 20px;
  text-align: center;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 188, 212, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  letter-spacing: 0.05em;
  color: var(--primary-color);
}

.hero p {
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
}

/* ============================================
   Layout
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  padding-bottom: 60px;
  position: relative;
  z-index: 5;
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumbs-wrapper {
  background: var(--bg-color);
  padding: 20px 0;
  position: relative;
  z-index: 10;
}

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

.breadcrumbs-text {
  font-size: 0.9rem;
  color: var(--text-light);
}

.breadcrumbs-text a {
  color: var(--text-light);
}

.breadcrumbs-text a:hover {
  color: var(--accent-color);
}

.breadcrumbs-text .separator {
  margin: 0 8px;
}

/* ============================================
   Section Title
   ============================================ */
.section-title {
  font-size: 1.5rem;
  margin-bottom: 30px;
  border-left: 5px solid var(--accent-color);
  padding-left: 15px;
}

/* ============================================
   Article Grid
   ============================================ */
.article-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

.article-card {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.article-card a {
  display: block;
  color: inherit;
}

.article-card a:hover {
  color: inherit;
}

.article-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.article-card:hover .article-thumb {
  transform: scale(1.03);
}

.article-thumb-wrapper {
  overflow: hidden;
}

.article-body {
  padding: 20px;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.category-label {
  background-color: var(--accent-color);
  color: white;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.category-label:hover {
  background-color: #0097a7;
  color: white;
}

.article-title {
  font-size: 1.1rem;
  margin-bottom: 15px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-excerpt {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.7;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.widget {
  background: var(--white);
  padding: 25px;
  margin-bottom: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.widget-title {
  font-size: 1.1rem;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.category-list li {
  margin-bottom: 10px;
}

.category-list a {
  display: flex;
  justify-content: space-between;
  color: var(--text-color);
  padding: 5px 0;
  transition: color 0.3s, padding-left 0.3s;
}

.category-list a:hover {
  padding-left: 5px;
}

.category-list a span,
.category-list .count {
  background: #eee;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Popular Posts Widget */
.popular-list {
  list-style: none;
}

.popular-item {
  margin-bottom: 15px;
}

.popular-link {
  display: flex;
  gap: 12px;
}

.popular-thumb {
  width: 80px;
  height: 80px;
  min-width: 80px;
  object-fit: cover;
  border-radius: 4px;
}

.popular-info h4 {
  font-size: 0.9rem;
  font-weight: normal;
  margin-bottom: 5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-info span {
  font-size: 0.8rem;
  color: #777;
}

/* ============================================
   Article Detail (Single Post)
   ============================================ */
.article-detail {
  background: var(--white);
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.article-header {
  margin-bottom: 30px;
  text-align: center;
}

.article-header h1 {
  font-size: 2rem;
  margin-bottom: 15px;
  line-height: 1.5;
}

.article-meta-center {
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
}

.article-tags {
  margin-top: 10px;
  text-align: center;
}

.tag-pill {
  background: #eee;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin: 0 5px;
  display: inline-block;
  transition: background 0.3s;
}

.tag-pill:hover {
  background: var(--accent-color);
  color: white;
}

.article-main-image {
  width: 100%;
  margin-bottom: 40px;
  border-radius: 8px;
}

.article-content {
  line-height: 2;
  font-size: 1rem;
}

.article-content h2 {
  font-size: 1.6rem;
  margin: 40px 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-color);
}

.article-content h3 {
  font-size: 1.4rem;
  margin: 30px 0 15px;
  border-left: 4px solid var(--accent-color);
  padding-left: 10px;
}

.article-content h4 {
  font-size: 1.2rem;
  margin: 25px 0 10px;
}

.article-content p {
  margin-bottom: 20px;
}

.article-content ul,
.article-content ol {
  margin: 15px 0 25px 30px;
  list-style: disc;
}

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

.article-content li {
  margin-bottom: 8px;
}

.article-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding: 15px 20px;
  margin: 20px 0;
  background: #f9f9f9;
  border-radius: 0 4px 4px 0;
  color: var(--text-light);
  font-style: italic;
}

.article-content pre,
.code-block {
  background: #f8f8f8;
  padding: 20px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
}

.article-content code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

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

.article-content img {
  border-radius: 8px;
  margin: 20px 0;
}

.article-content a {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Author Section */
.author-section {
  margin-top: 60px;
  background: #fafafa;
  padding: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.author-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  min-width: 80px;
}

.author-info h4 {
  font-size: 1.1rem;
  margin-bottom: 5px;
}

.author-info p {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.6;
}

/* Related Posts */
.related-posts-wrapper {
  margin-top: 60px;
}

.related-posts-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
  border-left: 5px solid var(--accent-color);
  padding-left: 15px;
}

/* ============================================
   Pagination
   ============================================ */
.pagination-container {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination-container .page-numbers {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.pagination-container .page-numbers.current {
  background: var(--accent-color);
  color: var(--white);
}

.pagination-container .page-numbers:not(.current) {
  background: var(--white);
  color: var(--text-color);
  border: 1px solid #ddd;
}

.pagination-container .page-numbers:not(.current):hover {
  background: var(--accent-color);
  color: var(--white);
  border-color: var(--accent-color);
}

.pagination-container .page-numbers.dots {
  border: none;
  background: none;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background-color: #222;
  color: #fff;
  padding: 60px 20px 20px;
  margin-top: 60px;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-section h3 {
  margin-bottom: 20px;
  font-size: 1.1rem;
  border-bottom: 1px solid #444;
  padding-bottom: 10px;
  display: inline-block;
}

.footer-description {
  color: #bbb;
  line-height: 1.6;
  font-size: 0.9rem;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: #bbb;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--accent-color);
}

.copyright {
  text-align: center;
  border-top: 1px solid #444;
  padding-top: 20px;
  color: #777;
  font-size: 0.9rem;
}

/* ============================================
   404 Page
   ============================================ */
.error-404-content {
  text-align: center;
  padding: 80px 20px;
}

.error-404-content h1 {
  font-size: 6rem;
  color: var(--accent-color);
  margin-bottom: 10px;
  font-weight: 700;
}

.error-404-content h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.error-404-content p {
  color: var(--text-light);
  margin-bottom: 30px;
}

.btn-back-home {
  display: inline-block;
  padding: 12px 30px;
  background: var(--accent-color);
  color: white;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.3s;
}

.btn-back-home:hover {
  background: #0097a7;
  color: white;
}

/* ============================================
   Page Template
   ============================================ */
.page-content {
  background: var(--white);
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.page-content h1 {
  font-size: 2rem;
  margin-bottom: 30px;
  text-align: center;
}

/* ============================================
   WordPress Default Classes
   ============================================ */
.alignleft {
  float: left;
  margin: 0 20px 20px 0;
}

.alignright {
  float: right;
  margin: 0 0 20px 20px;
}

.aligncenter {
  display: block;
  margin: 20px auto;
}

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

.wp-caption-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 5px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: block;
  }

  .main-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: auto;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    background: var(--white);
    padding: 20px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    z-index: 10000;
  }

  .main-nav.active {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
    gap: 15px;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .hero h2 {
    font-size: 1.6rem;
  }

  .hero {
    padding: 50px 20px;
  }

  .article-detail {
    padding: 20px;
  }

  .article-header h1 {
    font-size: 1.5rem;
    line-height: 1.4;
    word-break: break-all;
    overflow-wrap: anywhere;
    margin-top: 10px;
  }

  .article-header {
    padding: 0 10px;
  }

  .article-meta-center {
    flex-direction: column;
    gap: 5px;
    align-items: center;
  }

  .author-section {
    flex-direction: column;
    text-align: center;
  }

  .site-header {
    z-index: 9999;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero h2 {
    font-size: 1.3rem;
  }

  .article-title {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.2rem;
  }
}
