/*
Theme Name: MAYU屋テーマ
Theme URI: https://mayuya.com
Author: MAYU屋
Author URI: https://mayuya.com
Description: AI×業務自動化ブログ向けプレミアムテーマ
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mayuya-theme
Tags: blog, block-styles, full-site-editing, wide-blocks
*/

/* ==========================================================================
   1. CSS Custom Properties (Design System)
   ========================================================================== */

:root {
  /* Colors */
  --color-base: #0f172a;
  --color-contrast: #f8fafc;
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #e0e7ff;
  --color-secondary: #8b5cf6;
  --color-accent: #06b6d4;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-surface: #1e293b;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --color-border-dark: #334155;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-dark: linear-gradient(180deg, #0f172a, #1e293b);
  --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  --gradient-footer-border: linear-gradient(90deg, #6366f1, #06b6d4, #8b5cf6);

  /* Typography */
  --font-sans: system-ui, -apple-system, 'Hiragino Sans', 'Noto Sans JP', 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --line-height-ja: 1.8;
  --line-height-heading: 1.3;
  --letter-spacing-ja: 0.02em;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Layout */
  --content-width: 720px;
  --wide-width: 1200px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 20px 40px -12px rgba(99, 102, 241, 0.15);

  /* Borders */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. Animations
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes progressBar {
  from {
    width: 0;
  }
}

/* ==========================================================================
   3. Base / Reset Enhancements
   ========================================================================== */

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

body {
  font-family: var(--font-sans);
  font-feature-settings: 'palt' 1, 'kern' 1;
  line-height: var(--line-height-ja);
  letter-spacing: var(--letter-spacing-ja);
  color: var(--color-surface);
  background-color: var(--color-contrast);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: var(--color-primary);
  color: #fff;
}

::-moz-selection {
  background-color: var(--color-primary);
  color: #fff;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* ==========================================================================
   4. Reading Progress Bar
   ========================================================================== */

.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-primary);
  z-index: 9999;
  transition: width 100ms linear;
  border-radius: 0 2px 2px 0;
}

/* ==========================================================================
   5. Header / Glass Morphism
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.site-header.scrolled {
  background: rgba(248, 250, 252, 0.95);
  box-shadow: var(--shadow-md);
}

.site-header .wp-block-site-title a {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-base);
  letter-spacing: -0.01em;
}

.site-header .wp-block-navigation a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-surface);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.site-header .wp-block-navigation a:hover {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* ==========================================================================
   6. Hero Section
   ========================================================================== */

.hero-section {
  background: var(--gradient-hero);
  color: #fff;
  padding: var(--space-4xl) var(--space-lg);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(99, 102, 241, 0.2), transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(6, 182, 212, 0.15), transparent 50%);
  pointer-events: none;
}

.hero-section .hero-title {
  font-size: clamp(1.875rem, 4vw, 3rem);
  font-weight: 800;
  line-height: var(--line-height-heading);
  margin-bottom: var(--space-md);
  animation: slideUp 0.6s ease-out;
}

.hero-section .hero-description {
  font-size: clamp(1rem, 2vw, 1.25rem);
  opacity: 0.85;
  max-width: 600px;
  animation: slideUp 0.6s ease-out 0.15s both;
}

/* ==========================================================================
   7. Card Components
   ========================================================================== */

.post-card {
  background: #fff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  animation: fadeIn 0.5s ease-out;
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}

.post-card .post-card__image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.post-card .post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.post-card:hover .post-card__image img {
  transform: scale(1.05);
}

.post-card .post-card__content {
  padding: var(--space-lg);
}

.post-card .post-card__title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: var(--line-height-heading);
  margin-bottom: var(--space-sm);
  color: var(--color-base);
}

.post-card .post-card__title a {
  color: inherit;
}

.post-card .post-card__title a:hover {
  color: var(--color-primary);
}

.post-card .post-card__excerpt {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: var(--line-height-ja);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .post-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.post-card .post-card__reading-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   8. Category Badges
   ========================================================================== */

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.category-badge--ai,
.category-badge--生成ai {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.category-badge--python,
.category-badge--python自動化 {
  background-color: #dcfce7;
  color: #15803d;
}

.category-badge--tools,
.category-badge--aiツール比較 {
  background-color: #f3e8ff;
  color: #7c3aed;
}

.category-badge--career,
.category-badge--aiキャリア {
  background-color: #ffedd5;
  color: #c2410c;
}

.category-badge--wordpress {
  background-color: #ccfbf1;
  color: #0f766e;
}

/* ==========================================================================
   9. Article Typography
   ========================================================================== */

.entry-content {
  font-size: 1rem;
  line-height: var(--line-height-ja);
  color: var(--color-surface);
}

.entry-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-primary);
  line-height: var(--line-height-heading);
}

.entry-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
  border-left: 3px solid var(--color-secondary);
  line-height: var(--line-height-heading);
}

.entry-content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  line-height: var(--line-height-heading);
}

.entry-content p {
  margin-bottom: var(--space-lg);
}

.entry-content ul,
.entry-content ol {
  margin-bottom: var(--space-lg);
  padding-left: 1.5em;
}

.entry-content li {
  margin-bottom: var(--space-xs);
}

.entry-content blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  background-color: #f1f5f9;
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: normal;
  color: var(--color-surface);
}

.entry-content blockquote p:last-child {
  margin-bottom: 0;
}

.entry-content img {
  border-radius: var(--radius-lg);
  margin: var(--space-xl) 0;
}

.entry-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.entry-content a:hover {
  color: var(--color-primary-hover);
  text-decoration-color: var(--color-primary-hover);
}

/* ==========================================================================
   10. Table of Contents
   ========================================================================== */

.toc {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.toc__title {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--color-base);
}

.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc__list li {
  margin-bottom: var(--space-xs);
}

.toc__list a {
  font-size: 0.875rem;
  color: var(--color-muted);
  display: block;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.toc__list a:hover {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.toc__list .toc__item--h3 {
  padding-left: var(--space-lg);
}

/* ==========================================================================
   11. Code Blocks (Dark Theme)
   ========================================================================== */

.entry-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: var(--space-xl) 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  border: 1px solid #313244;
  -webkit-overflow-scrolling: touch;
}

.entry-content pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.entry-content code {
  background: #f1f5f9;
  color: #c026d3;
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* ==========================================================================
   12. Author Bio Card
   ========================================================================== */

.author-bio {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
  padding: var(--space-xl);
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin: var(--space-3xl) 0;
  animation: scaleIn 0.4s ease-out;
}

.author-bio__avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.author-bio__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-bio__name {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: var(--color-base);
}

.author-bio__description {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: var(--line-height-ja);
}

.author-bio__links {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.author-bio__links a {
  font-size: 0.8125rem;
  color: var(--color-primary);
  font-weight: 500;
}

/* ==========================================================================
   13. Related Articles Grid
   ========================================================================== */

.related-articles {
  margin: var(--space-3xl) 0;
}

.related-articles__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-xl);
  color: var(--color-base);
}

.related-articles__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.related-articles__item {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.related-articles__item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.related-articles__item-image {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.related-articles__item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-articles__item-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: var(--line-height-heading);
  color: var(--color-base);
}

.related-articles__item-title a {
  color: inherit;
}

.related-articles__item-title a:hover {
  color: var(--color-primary);
}

/* ==========================================================================
   14. Pagination
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin: var(--space-3xl) 0;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.pagination .page-numbers:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.pagination .page-numbers.current {
  color: #fff;
  background: var(--gradient-primary);
  border-color: transparent;
  font-weight: 700;
}

.pagination .page-numbers.dots {
  border: none;
  background: transparent;
  cursor: default;
}

.pagination .prev.page-numbers,
.pagination .next.page-numbers {
  font-weight: 600;
}

/* ==========================================================================
   15. Footer
   ========================================================================== */

.site-footer {
  background: var(--gradient-dark);
  color: rgba(248, 250, 252, 0.7);
  padding: var(--space-3xl) var(--space-lg) var(--space-xl);
  position: relative;
  margin-top: var(--space-4xl);
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-footer-border);
}

.site-footer a {
  color: rgba(248, 250, 252, 0.7);
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: #fff;
}

.site-footer .footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-xl);
  margin-bottom: var(--space-xl);
}

.site-footer .footer-nav a {
  font-size: 0.875rem;
}

.site-footer .footer-copyright {
  font-size: 0.8125rem;
  opacity: 0.6;
  text-align: center;
}

/* ==========================================================================
   16. Utility Classes
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

/* ==========================================================================
   17. WordPress Block Overrides
   ========================================================================== */

.wp-block-separator {
  border-color: var(--color-border);
  opacity: 1;
}

.wp-block-separator.is-style-wide {
  border-bottom-width: 1px;
}

.wp-block-table table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
}

.wp-block-table th,
.wp-block-table td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  text-align: left;
}

.wp-block-table th {
  background: #f1f5f9;
  font-weight: 600;
}

.wp-block-button__link {
  border-radius: var(--radius-full);
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.wp-block-button__link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   18. Responsive Breakpoints (Mobile-First)
   ========================================================================== */

/* 480px+ */
@media (min-width: 30em) {
  .related-articles__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 768px+ */
@media (min-width: 48em) {
  .hero-section {
    padding: var(--space-4xl) var(--space-2xl);
    text-align: center;
  }

  .hero-section .hero-description {
    margin-inline: auto;
  }

  .post-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }

  .related-articles__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .entry-content {
    font-size: 1.0625rem;
  }
}

/* 1024px+ */
@media (min-width: 64em) {
  .post-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .related-articles__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-section {
    padding: 5rem var(--space-2xl);
  }
}

/* 1280px+ */
@media (min-width: 80em) {
  .post-cards-grid {
    gap: var(--space-2xl);
  }
}

/* Mobile adjustments */
@media (max-width: 47.9375em) {
  .author-bio {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .author-bio__links {
    justify-content: center;
  }

  .site-footer .footer-nav {
    flex-direction: column;
    align-items: center;
  }
}
