/*
Theme Name: Web制作トラブルノート
Description: Web制作の困りごとを解決する技術メディア用テーマ
Version: 2.1.0
Author: oceanbluese
Text Domain: affiliate-sample-theme
*/

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&display=swap');

:root {
  --brand:        #087E8B;
  --brand-dark:   #075E68;
  --brand-light:  #2DA7B3;
  --accent:       #FFD166;
  --white:        #ffffff;
  --bg:           #F5F8FA;
  --text:         #20313A;
  --gray:         #6B7C85;
  --border:       #DCE7EA;
  --navy:         #132A35;
  --radius:       8px;
  --shadow:       0 2px 12px rgba(0,0,0,.07);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.11);
  --space-1: 4px;  --space-2: 8px;   --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px;  --space-7: 32px; --space-8: 40px;
  --space-9: 48px; --space-10: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
  font-size: 15px; line-height: 1.8;
  color: var(--text); background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ===== Layout ===== */
.site-container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.site-header .site-container,
.site-footer .site-container { padding-block: 0; }
.content-wrap { display: flex; gap: 32px; padding: 32px 0; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 280px; flex-shrink: 0; }

/* ===== Header ===== */
.site-header {
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 24px;
}
.site-logo a {
  display: flex; align-items: center;
  text-decoration: none; line-height: 1;
}
.site-logo-text {
  font-size: 20px; font-weight: 900; color: #fff;
  letter-spacing: -.02em;
}
.site-nav ul { display: flex; list-style: none; gap: 4px; }
.site-nav a {
  color: rgba(255,255,255,.9); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 4px; text-decoration: none;
  transition: background .15s;
}
.site-nav a:hover { background: rgba(255,255,255,.15); color: var(--white); }
.header-search form { display: flex; }
.header-search input {
  padding: 6px 12px; border: none; border-radius: 20px 0 0 20px;
  font-size: 13px; width: 160px; outline: none;
}
.header-search button {
  background: var(--accent); border: none; border-radius: 0 20px 20px 0;
  padding: 6px 12px; cursor: pointer; font-size: 14px;
}
.hamburger-btn {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger-btn span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px; transition: .2s;
}

/* ===== Mobile Nav ===== */
.mobile-nav-overlay {
  display: none; position: fixed; inset: 64px 0 0;
  background: var(--navy); z-index: 99; overflow-y: auto; padding: 16px;
}
.mobile-nav-overlay.open { display: block; }
.mobile-nav-overlay ul { list-style: none; }
.mobile-nav-overlay li a {
  display: block; padding: 12px 8px;
  color: #fff; border-bottom: 1px solid rgba(255,255,255,.1);
  font-size: 15px;
}
.mobile-search { margin-bottom: 16px; }
.mobile-search form { display: flex; }
.mobile-search input {
  flex: 1; padding: 10px 14px; border: none; border-radius: 6px 0 0 6px;
  font-size: 14px; outline: none;
}
.mobile-search button {
  background: var(--accent); border: none; border-radius: 0 6px 6px 0;
  padding: 10px 14px; cursor: pointer; font-size: 14px;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  background: var(--white); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--gray);
}
.breadcrumb .site-container { padding-block: 8px; }
.breadcrumb a { color: var(--gray); }
.breadcrumb span { margin: 0 6px; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 50%, var(--brand-light) 100%);
  color: var(--white); padding: 64px 16px; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 24px 24px;
}
.hero-inner {
  position: relative; max-width: 680px; text-align: center; margin: 0 auto;
}
.hero-eyebrow {
  display: inline-block; background: var(--accent); color: #333;
  font-size: 12px; font-weight: 700; padding: 3px 12px;
  border-radius: 20px; margin-bottom: 16px; letter-spacing: .08em;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 56px); font-weight: 900; line-height: 1.2;
  letter-spacing: -.02em; margin-bottom: 16px;
  text-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.h1-accent { color: var(--accent); }
.hero-lead {
  font-size: 16px; font-weight: 500; opacity: .95; margin-bottom: 8px;
}
.hero-note {
  font-size: 13px; opacity: .75; margin-bottom: 28px;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 28px; border-radius: 24px;
  font-size: 14px; font-weight: 700; text-decoration: none;
  transition: transform .15s, box-shadow .15s; cursor: pointer; border: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.2); text-decoration: none; }
.btn-white  { background: var(--white); color: var(--brand); }
.btn-accent { background: var(--accent); color: #333; }
.btn-brand  { background: var(--brand); color: var(--white); }
.btn-outline { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,.7); }

/* ===== Stats Bar ===== */
.stats-bar {
  background: var(--white); border-bottom: 1px solid var(--border); padding: 16px 0;
}
.stats-bar .site-container {
  display: flex; justify-content: center; gap: 48px; flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num { font-size: 22px; font-weight: 900; color: var(--brand); }
.stat-label { font-size: 11px; color: var(--gray); }

/* ===== Sections ===== */
.section { padding: 48px 0; }
.section-alt { background: var(--white); }
.section-header { text-align: center; margin-bottom: 36px; }
.section-header h2 {
  font-size: 22px; font-weight: 900; color: var(--text);
  display: inline-flex; align-items: center; gap: 10px;
}
.section-header h2::before,
.section-header h2::after {
  content: ''; display: inline-block; width: 36px; height: 3px;
  background: var(--brand); border-radius: 2px;
}
.section-header p { color: var(--gray); font-size: 13px; margin-top: 8px; }

/* ===== Category Grid ===== */
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px;
}
.category-card {
  background: var(--white); border-radius: var(--radius);
  padding: 24px 12px 20px; text-align: center;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  text-decoration: none; color: var(--text); display: block;
  border-top: 3px solid var(--border);
}
.category-card:hover {
  transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.12);
  border-top-color: var(--brand); text-decoration: none; color: var(--text);
}
.category-card .cat-icon { font-size: 36px; margin-bottom: 10px; display: block; }
.category-card .cat-name { font-size: 13px; font-weight: 700; line-height: 1.4; }
.category-card .cat-count { font-size: 11px; color: var(--gray); margin-top: 4px; }

/* ===== Post Cards ===== */
.posts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px;
}
.post-card {
  background: var(--white); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.post-card-thumb { aspect-ratio: 16/9; overflow: hidden; background: #f0f0f0; }
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.post-card:hover .post-card-thumb img { transform: scale(1.05); }
.post-card-thumb .no-thumb {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; font-size: 48px;
}
.post-card-body { padding: 16px; }
.post-card-cat {
  display: inline-block; background: var(--brand); color: var(--white);
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 3px;
  margin-bottom: 8px; text-decoration: none;
}
.post-card-cat:hover { background: var(--brand-dark); color: var(--white); }
.post-card-title {
  font-size: 14px; font-weight: 700; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--brand); text-decoration: none; }
.post-card-meta { font-size: 12px; color: var(--gray); }

/* ===== Pagination ===== */
.pagination { margin-top: 32px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 6px;
  font-size: 13px; font-weight: 700; text-decoration: none;
  background: var(--white); color: var(--text); box-shadow: var(--shadow);
}
.pagination .current { background: var(--brand); color: var(--white); }
.pagination a:hover { background: var(--brand-light); color: var(--white); text-decoration: none; }

/* ===== Category Banner ===== */
.cat-page-banner {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: var(--white); padding: 40px 16px; text-align: center; margin-bottom: 8px;
}
.cat-page-banner .cat-page-banner-icon { font-size: 48px; margin-bottom: 8px; }
.cat-page-banner h1 { font-size: 26px; font-weight: 900; margin-bottom: 8px; }
.cat-page-banner p { opacity: .9; font-size: 14px; }

/* ===== Archive Header ===== */
.archive-header { margin-bottom: 24px; }
.archive-title { font-size: 22px; font-weight: 900; color: var(--text); }

/* ===== Post (single) ===== */
.post-header {
  background: var(--white); padding: 28px; border-radius: var(--radius);
  margin-bottom: 20px; box-shadow: var(--shadow);
}
.post-cats { margin-bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.post-cat-badge {
  display: inline-block; background: var(--brand); color: var(--white);
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 3px;
  text-decoration: none;
}
.post-title { font-size: clamp(18px, 3vw, 26px); font-weight: 900; line-height: 1.4; margin-bottom: 12px; }
.post-meta { font-size: 13px; color: var(--gray); display: flex; gap: 16px; flex-wrap: wrap; }

.post-content {
  background: var(--white); padding: 28px; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.post-content h2 {
  font-size: 19px; font-weight: 900;
  border-left: 4px solid var(--brand); padding-left: 12px;
  margin: 28px 0 14px;
}
.post-content h3 {
  font-size: 16px; font-weight: 700;
  border-bottom: 2px solid var(--border); padding-bottom: 6px;
  margin: 22px 0 12px;
}
.post-content p { margin-bottom: 16px; }
.post-content ul, .post-content ol { padding-left: 24px; margin-bottom: 16px; }
.post-content li { margin-bottom: 6px; }
.post-content img { border-radius: var(--radius); margin: 16px 0; }
.post-content a { text-decoration: underline; }
.post-content :not(pre) > code,
.entry-content :not(pre) > code {
  background: #e8f1f3; color: #075e68; border-radius: 4px;
  padding: 2px 6px; font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: .92em; overflow-wrap: anywhere;
}
.post-content pre,
.entry-content pre {
  position: relative; overflow-x: auto; margin: 20px 0;
  padding: 50px 20px 20px; border: 1px solid #294653;
  border-radius: var(--radius); background: #132a35; color: #e8f3f5;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.post-content pre code,
.entry-content pre code {
  display: block; min-width: max-content; padding: 0; background: transparent;
  color: inherit; font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 13px; line-height: 1.7; white-space: pre; tab-size: 2;
}
.code-copy-button {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  border: 1px solid rgba(255,255,255,.25); border-radius: 5px;
  background: #244652; color: #fff; padding: 5px 11px;
  font-family: inherit; font-size: 12px; font-weight: 700;
  line-height: 1.4; cursor: pointer; transition: background .15s, border-color .15s;
}
.code-copy-button:hover,
.code-copy-button:focus-visible { background: var(--brand); border-color: #75d4dc; outline: none; }
.code-copy-button.is-copied { background: #16865b; border-color: #70d7ad; }
.code-copy-button.is-error { background: #a33a3a; border-color: #e59a9a; }

/* Affiliate disclosure box */
.article-note {
  background: #eef8f9; border: 1px solid #c7e5e8; border-radius: var(--radius);
  padding: 16px 20px; margin-top: 24px; font-size: 13px; color: #666;
}
.article-note p { margin-bottom: 0; }

/* ===== Sidebar ===== */
.widget {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 24px; overflow: hidden;
}
.widget-title {
  font-size: 13px; font-weight: 700;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  color: var(--white); padding: 10px 16px; margin-bottom: 0;
}
.widget ul { list-style: none; padding: 12px 16px; }
.widget ul li { border-bottom: 1px solid var(--border); }
.widget ul li:last-child { border-bottom: none; }
.widget ul li a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; font-size: 13px; color: var(--text); text-decoration: none;
}
.widget ul li a:hover { color: var(--brand); }
.cat-count-badge {
  background: var(--border); color: var(--gray);
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}

.about-widget { padding: 14px 16px 16px; }
.about-widget p { font-size: 13px; color: var(--gray); margin-bottom: 10px; }
.topic-list { list-style: none !important; padding: 0 !important; }
.topic-list li { padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.widget-contact p { font-size: 13px; padding: 12px 16px 0; color: var(--gray); }
.widget-contact .btn { margin: 10px 16px 14px; width: calc(100% - 32px); justify-content: center; font-size: 13px; }

/* ===== Page (static) ===== */
.page-content {
  background: var(--white); padding: 28px; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.page-title { font-size: 22px; font-weight: 900; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--border); }
.entry-content p { margin-bottom: 16px; }
.entry-content h2 { font-size: 18px; font-weight: 900; margin: 24px 0 12px; border-left: 4px solid var(--brand); padding-left: 10px; }

/* ===== Footer ===== */
.site-footer {
  background: var(--navy); color: rgba(255,255,255,.75);
  padding: 40px 0 0; margin-top: 40px;
}
.footer-main {
  display: grid; grid-template-columns: 2fr 1fr 1fr;
  gap: 40px; padding: 0 0 32px;
}
.footer-brand .brand-name { font-size: 18px; font-weight: 900; color: var(--white); margin-bottom: 10px; }
.brand-desc { font-size: 13px; line-height: 1.8; }
.footer-col h4 { font-size: 12px; font-weight: 700; color: var(--white); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { font-size: 13px; color: rgba(255,255,255,.6); }
.footer-col a:hover { color: var(--white); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 16px 0; text-align: center; font-size: 12px; color: rgba(255,255,255,.4);
}
.footer-bottom p { margin-bottom: 4px; }

/* ===== Contact Form 7 ===== */
.contact-page .wpcf7 { margin-top: 8px; }
.contact-form-inner .wpcf7-form p {
  margin-bottom: 18px;
}
.contact-form-inner .wpcf7-form label,
.contact-form-inner .wpcf7-form p > :first-child {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--text); margin-bottom: 6px;
}
.contact-form-inner input[type="text"],
.contact-form-inner input[type="email"],
.contact-form-inner textarea {
  width: 100%; padding: 10px 14px;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .15s; background: #fff;
}
.contact-form-inner input[type="text"]:focus,
.contact-form-inner input[type="email"]:focus,
.contact-form-inner textarea:focus {
  border-color: var(--brand);
}
.contact-form-inner textarea { min-height: 140px; resize: vertical; }
.contact-form-inner .wpcf7-submit {
  background: var(--brand); color: #fff;
  border: none; border-radius: 24px;
  padding: 12px 36px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background .15s, transform .15s;
}
.contact-form-inner .wpcf7-submit:hover {
  background: var(--brand-dark); transform: translateY(-2px);
}
.wpcf7-not-valid-tip { color: #e05; font-size: 12px; margin-top: 4px; display: block; }
.wpcf7-response-output {
  margin-top: 16px; padding: 12px 16px;
  border-radius: var(--radius); font-size: 13px;
}
.wpcf7-mail-sent-ok { background: #e8f5e9; border: 1px solid #a5d6a7; color: #2e7d32; }
.wpcf7-validation-errors { background: #fff3e0; border: 1px solid #ffcc02; color: #e65100; }
.wpcf7-spam-blocked { background: #fce4ec; border: 1px solid #f48fb1; color: #c62828; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .site-nav, .header-search { display: none; }
  .hamburger-btn { display: flex; }
  .content-wrap { flex-direction: column; }
  .sidebar { width: 100%; }
  .hero { padding: 40px 16px; }
  .footer-main { grid-template-columns: 1fr; gap: 24px; }
  .stats-bar .site-container { gap: 24px; }
}
