/*
Theme Name: Tomz Service Pro
Theme URI: https://tomz-service.com
Author: 1NDLY
Description: お庭の便利屋トムズ専用プロテーマ - SEO最強化+集客最適化+Core Web Vitals対応
Version: 2.0.0
License: GNU General Public License v2 or later
Text Domain: tomz-theme-pro
*/

/* ===== CSS Variables ===== */
:root {
  --primary: #2d5a27;
  --primary-dark: #1a3d18;
  --primary-light: #3a7a32;
  --accent: #ffd700;
  --accent-dark: #e6c200;
  --bg-light: #f5f7f0;
  --bg-white: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --line-green: #06C755;
  --line-dark: #05b04a;
  --danger: #e74c3c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 15px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --header-height: 80px;
  --header-height-shrink: 60px;
  --transition: 0.3s ease;
  --font-base: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

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

body {
  font-family: var(--font-base);
  color: var(--text);
  background: var(--bg-light);
  line-height: 2.0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-dark); }
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { line-height: 1.4; font-weight: 700; }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Skip Navigation (A11y) ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  z-index: 10000;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 700;
  transition: top var(--transition);
}
.skip-link:focus {
  top: 0;
  color: #fff;
}

/* ===== Utility ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== Animations ===== */
.fade-in {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

.slide-in-left {
  opacity: 0; transform: translateX(-50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.slide-in-left.visible { opacity: 1; transform: translateX(0); }

.slide-in-right {
  opacity: 0; transform: translateX(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.slide-in-right.visible { opacity: 1; transform: translateX(0); }

/* ===== Trust Badges ===== */
.trust-bar {
  background: var(--primary);
  color: #fff;
  padding: 10px 0;
  text-align: center;
}
.trust-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}
.trust-badge svg { flex-shrink: 0; }
.trust-star {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-white);
  height: var(--header-height);
  transition: height var(--transition), box-shadow var(--transition);
  will-change: height;
}
.site-header.scrolled {
  height: var(--header-height-shrink);
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-logo a {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 0.05em;
  transition: font-size var(--transition);
}
.site-header.scrolled .site-logo a { font-size: 1.2rem; }
.site-logo a span { color: var(--accent); }

/* Navigation */
.nav-menu {
  display: flex; align-items: center; gap: 24px;
}
.nav-menu a {
  font-size: 1.05rem; font-weight: 600; color: var(--text);
  position: relative; padding: 8px 0;
}
.nav-menu a::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 0; height: 2px; background: var(--primary);
  transition: width var(--transition);
}
.nav-menu a:hover::after,
.nav-menu a[aria-current="page"]::after { width: 100%; }

/* Header Buttons */
.header-buttons { display: flex; align-items: center; gap: 10px; }
.btn-phone {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 20px; background: var(--primary); color: #fff;
  border-radius: var(--radius); font-size: 1rem; font-weight: 700;
  transition: background var(--transition), transform var(--transition);
}
.btn-phone:hover { background: var(--primary-dark); color: #fff; transform: scale(1.03); }

.btn-line {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 20px; background: var(--line-green); color: #fff;
  border-radius: var(--radius); font-size: 1rem; font-weight: 700;
  transition: background var(--transition), transform var(--transition);
}
.btn-line:hover { background: var(--line-dark); color: #fff; transform: scale(1.03); }

/* Hamburger */
.hamburger {
  display: none; flex-direction: column; justify-content: center;
  gap: 5px; width: 30px; height: 30px;
  background: none; border: none; cursor: pointer; z-index: 1100;
}
.hamburger span {
  display: block; width: 100%; height: 2px; background: var(--text);
  transition: transform var(--transition), opacity var(--transition);
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Nav Overlay */
.mobile-nav {
  display: none; position: fixed; top: 0; left: 0;
  width: 100%; height: 100%; background: rgba(0,0,0,0.95);
  z-index: 1050; flex-direction: column;
  align-items: center; justify-content: center; gap: 30px;
}
.mobile-nav.active { display: flex; }
.mobile-nav a { color: #fff; font-size: 1.5rem; font-weight: 700; padding: 8px 0; }
.mobile-nav a:hover { color: var(--accent); }

/* ===== Breadcrumb ===== */
.breadcrumb {
  font-size: 1rem; color: var(--text-muted);
  margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 4px;
  padding: 12px 0;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .separator { margin: 0 4px; }

/* ===== Front Page / Page ===== */
.front-page-content,
.page-content {
  background: transparent;
  min-height: calc(100vh - var(--header-height) - 200px);
}
.front-page-content .entry-content,
.page-content .entry-content {
  max-width: 100%;
}
/* Full-width blocks inside content */
.entry-content > div,
.entry-content > section {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}
.entry-content > .container,
.entry-content > .wp-block-group:not(.alignfull) {
  width: auto;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Single Post ===== */
.single-post-wrap {
  max-width: 800px; margin: 0 auto; padding: 40px 20px;
}

.post-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px;
}
.post-meta .category-badge {
  background: var(--primary); color: #fff;
  padding: 2px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}

.single-post-wrap h1.post-title {
  font-size: 1.8rem; margin-bottom: 16px; color: var(--text);
}

.post-thumbnail {
  margin-bottom: 30px; border-radius: var(--radius); overflow: hidden;
}
.post-thumbnail img { width: 100%; height: auto; }

/* Post Content */
.post-content {
  background: var(--bg-white); padding: 40px;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.post-content h2 {
  font-size: 1.5rem; margin: 40px 0 16px;
  padding-bottom: 8px; border-bottom: 3px solid var(--primary);
  color: var(--primary-dark);
}
.post-content h3 {
  font-size: 1.2rem; margin: 30px 0 12px;
  padding-left: 12px; border-left: 4px solid var(--accent);
}
.post-content p { margin-bottom: 1.6em; }
.post-content ul, .post-content ol { margin: 1em 0; padding-left: 1.5em; }
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li { margin-bottom: 0.5em; }
.post-content blockquote {
  margin: 1.5em 0; padding: 20px 24px;
  border-left: 4px solid var(--primary);
  background: var(--bg-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}
.post-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
.post-content th, .post-content td {
  padding: 10px 14px; border: 1px solid #ddd; text-align: left;
}
.post-content th { background: var(--primary); color: #fff; }
.post-content img { border-radius: var(--radius); margin: 1em 0; }

/* Post Navigation */
.post-navigation {
  display: flex; justify-content: space-between; gap: 20px;
  margin-top: 40px; padding-top: 30px;
  border-top: 1px solid #e0e0e0;
}
.post-navigation a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 16px; background: var(--bg-light);
  border-radius: var(--radius-sm);
  max-width: 48%; transition: background var(--transition);
}
.post-navigation a:hover { background: #e8ede3; }
.post-navigation .nav-label {
  font-size: 0.75rem; color: var(--text-muted); font-weight: 600;
}
.post-navigation .nav-title {
  font-size: 0.9rem; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 1;
  -webkit-box-orient: vertical; overflow: hidden;
}
.post-navigation .nav-next { text-align: right; margin-left: auto; }

/* Related Posts */
.related-posts {
  margin-top: 60px; padding-top: 40px;
  border-top: 1px solid #e0e0e0;
}
.related-posts h2 {
  font-size: 1.3rem; margin-bottom: 24px; color: var(--primary-dark);
}
.related-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.related-card {
  background: var(--bg-white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.related-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
}
.related-card img {
  width: 100%; height: 150px; object-fit: cover;
  transition: transform var(--transition);
}
.related-card:hover img { transform: scale(1.03); }
.related-card .card-body { padding: 14px; }
.related-card .card-title {
  font-size: 0.9rem; font-weight: 600; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.related-card .card-date {
  font-size: 0.8rem; color: var(--text-muted); margin-top: 8px;
}

/* ===== Archive ===== */
.archive-wrap {
  max-width: 800px; margin: 0 auto; padding: 40px 20px;
}
.archive-title {
  font-size: 1.6rem; margin-bottom: 30px; color: var(--primary-dark);
  padding-bottom: 10px; border-bottom: 3px solid var(--primary);
}
.archive-description {
  margin-bottom: 24px; font-size: 0.95rem; color: var(--text-light);
  line-height: 1.7;
}
.archive-list { display: flex; flex-direction: column; gap: 20px; }
.archive-item {
  display: flex; gap: 20px; background: var(--bg-white);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform var(--transition);
}
.archive-item:hover { transform: translateY(-3px); }
.archive-item .thumb { width: 200px; min-height: 140px; flex-shrink: 0; overflow: hidden; }
.archive-item .thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform var(--transition);
}
.archive-item:hover .thumb img { transform: scale(1.03); }
.archive-item .item-body {
  padding: 16px; display: flex; flex-direction: column; justify-content: center;
}
.archive-item .item-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.archive-item .item-excerpt {
  font-size: 0.9rem; color: var(--text-light); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.archive-item .item-date { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 0.9rem; font-weight: 600; transition: all var(--transition);
}
.pagination a { background: var(--bg-white); color: var(--text); box-shadow: var(--shadow); }
.pagination a:hover { background: var(--primary); color: #fff; }
.pagination .current { background: var(--primary); color: #fff; }

/* ===== Floating CTA ===== */
.floating-cta {
  position: fixed; bottom: 0; left: 0; width: 100%;
  z-index: 800; display: flex;
  transform: translateY(100%);
  transition: transform 0.4s ease;
}
.floating-cta.visible { transform: translateY(0); }
.floating-cta a {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex: 1; padding: 18px; color: #fff;
  font-weight: 700; font-size: 1.1rem;
  transition: filter var(--transition);
}
.floating-cta a:hover { filter: brightness(1.1); color: #fff; }
.floating-cta .cta-phone-btn { background: var(--primary); }
.floating-cta .cta-line-btn { background: var(--line-green); }

/* ===== Exit Intent Popup ===== */
.exit-popup-overlay {
  display: none; position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 9000;
  align-items: center; justify-content: center;
}
.exit-popup-overlay.active { display: flex; }
.exit-popup {
  background: var(--bg-white); border-radius: var(--radius);
  padding: 40px; max-width: 480px; width: 90%;
  text-align: center; position: relative;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.3s ease;
}
@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.exit-popup-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--text-muted);
  line-height: 1; padding: 4px;
}
.exit-popup-close:hover { color: var(--text); }
.exit-popup h3 {
  font-size: 1.4rem; color: var(--primary-dark); margin-bottom: 8px;
}
.exit-popup .popup-sub {
  font-size: 0.95rem; color: var(--text-light); margin-bottom: 24px;
}
.exit-popup .popup-buttons {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.exit-popup .popup-buttons a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: var(--radius);
  font-weight: 700; font-size: 1rem; color: #fff;
  transition: transform var(--transition), box-shadow var(--transition);
}
.exit-popup .popup-buttons a:hover {
  transform: scale(1.05); box-shadow: var(--shadow-md); color: #fff;
}
.exit-popup .popup-btn-phone { background: var(--primary); }
.exit-popup .popup-btn-line { background: var(--line-green); }

/* ===== Counter Animation ===== */
.counter-value {
  font-size: 2.5rem; font-weight: 900; color: var(--primary);
  line-height: 1.2;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--primary-dark); color: #fff; padding: 60px 0 30px;
}
.footer-inner {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
}
.footer-section h3 {
  font-size: 1rem; margin-bottom: 16px; color: var(--accent);
}
.footer-section ul { display: flex; flex-direction: column; gap: 8px; }
.footer-section a { color: rgba(255,255,255,0.8); font-size: 0.9rem; }
.footer-section a:hover { color: var(--accent); }
.footer-contact { display: flex; flex-direction: column; gap: 12px; }
.footer-contact a {
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 600;
}
.footer-social {
  display: flex; gap: 16px; margin-top: 16px;
}
.footer-social a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: #fff;
  transition: background var(--transition), transform var(--transition);
}
.footer-social a:hover {
  background: var(--accent); color: var(--primary-dark);
  transform: scale(1.1);
}
.footer-map {
  margin-top: 16px; border-radius: var(--radius-sm); overflow: hidden;
}
.footer-map iframe {
  width: 100%; height: 200px; border: 0;
}
.footer-bottom {
  text-align: center; padding-top: 30px; margin-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.85rem; color: rgba(255,255,255,0.6);
}

/* Back to Top */
.back-to-top {
  position: fixed; bottom: 80px; right: 30px;
  width: 48px; height: 48px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 50%; font-size: 1.2rem;
  cursor: pointer; opacity: 0; visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
  z-index: 900; display: flex; align-items: center; justify-content: center;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--primary-dark); transform: translateY(-3px); }

/* ===== 404 ===== */
.error-404-wrap {
  max-width: 600px; margin: 0 auto; padding: 80px 20px; text-align: center;
}
.error-404-wrap h1 { font-size: 5rem; color: var(--primary); margin-bottom: 16px; }
.error-404-wrap p {
  font-size: 1.1rem; color: var(--text-light); margin-bottom: 30px;
}
.error-404-wrap .search-form {
  display: flex; max-width: 400px; margin: 0 auto 24px;
}
.error-404-wrap .search-field {
  flex: 1; padding: 12px 16px; border: 2px solid #ddd;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 1rem; outline: none; font-family: var(--font-base);
}
.error-404-wrap .search-field:focus { border-color: var(--primary); }
.error-404-wrap .search-submit {
  padding: 12px 20px; background: var(--primary); color: #fff;
  border: none; border-radius: 0 var(--radius) var(--radius) 0;
  font-weight: 700; cursor: pointer; font-family: var(--font-base);
  transition: background var(--transition);
}
.error-404-wrap .search-submit:hover { background: var(--primary-dark); }

.btn-home {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 32px; background: var(--primary); color: #fff;
  border-radius: var(--radius); font-weight: 700; font-size: 1rem;
  transition: background var(--transition), transform var(--transition);
}
.btn-home:hover { background: var(--primary-dark); color: #fff; transform: scale(1.03); }

/* ===== CTA Buttons (common) ===== */
.btn-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 36px; border-radius: var(--radius);
  font-weight: 700; font-size: 1.05rem; cursor: pointer; border: none;
  transition: transform var(--transition), box-shadow var(--transition);
}
.btn-cta:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }

/* ===== WordPress Core Overrides ===== */
.wp-block-image { margin: 1.5em 0; }
.alignfull { width: 100vw; max-width: 100vw; margin-left: calc(-50vw + 50%); }
.alignwide { max-width: 1200px; margin-left: auto; margin-right: auto; }

/* ===== HTML Sitemap ===== */
.html-sitemap {
  max-width: 800px; margin: 40px auto; padding: 0 20px;
}
.html-sitemap h2 {
  font-size: 1.3rem; color: var(--primary-dark);
  margin: 30px 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}
.html-sitemap ul { padding-left: 1.5em; list-style: disc; }
.html-sitemap li { margin-bottom: 8px; }
.html-sitemap a { font-size: 0.95rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root { --header-height: 60px; --header-height-shrink: 56px; }

  .nav-menu, .header-buttons .btn-phone-text { display: none; }
  .hamburger { display: flex; }
  .header-buttons { gap: 8px; }
  .trust-bar-inner { gap: 12px; font-size: 0.78rem; }

  .footer-inner { grid-template-columns: 1fr; gap: 30px; }
  .single-post-wrap { padding: 20px 16px; }
  .post-content { padding: 24px 20px; }
  .post-content h2 { font-size: 1.3rem; }
  .related-grid { grid-template-columns: 1fr; }
  .post-navigation { flex-direction: column; }
  .post-navigation a { max-width: 100%; }

  .archive-item { flex-direction: column; }
  .archive-item .thumb { width: 100%; min-height: 180px; }

  .floating-cta a { padding: 12px; font-size: 0.85rem; }
  .back-to-top { bottom: 70px; right: 16px; }

  .entry-content > div,
  .entry-content > section {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
  }
}

@media (max-width: 480px) {
  html { font-size: 15px; }
  .single-post-wrap h1.post-title { font-size: 1.4rem; }
  .post-content { padding: 20px 16px; }
  .error-404-wrap h1 { font-size: 3.5rem; }
  .counter-value { font-size: 2rem; }
}
