/*
Theme Name: Tech Pulse
Theme URI: https://example.com/tech-pulse
Author: Tech Pulse
Author URI: https://example.com
Description: テックニュース・トレンド速報メディア向けに構築した、SEO最適化・軽量・レスポンシブ対応のWordPressオリジナルテーマ。構造化データ、OGP、パンくず、人気記事、関連記事、SNSシェアなどインプレッション獲得に必要な機能を標準搭載。
Version: 1.0.8
Requires at least: 6.0
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: techpulse
Tags: blog, news, two-columns, custom-logo, featured-images, translation-ready
*/

/* ==========================================================================
   0. Variables & reset
   ========================================================================== */
:root {
	--accent: #2F6FED;
	--accent-dark: #1d4fc4;
	--accent-soft: #eaf1ff;
	--text: #16181d;
	--text-secondary: #6b7280;
	--bg: #ffffff;
	--bg-secondary: #f6f7f9;
	--border: #e7e9ed;
	--radius: 12px;
	--radius-sm: 8px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
	--shadow-hover: 0 12px 28px rgba(16, 24, 40, .12);
	--font: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
	--container: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-y: scroll; scrollbar-gutter: stable; }
body {
	margin: 0;
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.75;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .6em; font-weight: 700; }
p { margin: 0 0 1.2em; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

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

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px,1px,1px,1px);
}
.skip-link {
	position: absolute; left: -9999px; top: 10px; z-index: 9999;
	background: var(--accent); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 10px; }

/* ==========================================================================
   1. Header
   ========================================================================== */
.site-header {
	position: sticky; top: 0; z-index: 500;
	background: rgba(255,255,255,.92);
	backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid var(--border);
}
.header-inner {
	display: flex; align-items: center; gap: 24px;
	height: 68px; position: relative;
}
.site-branding { flex: 0 0 auto; }
.site-title-link { display: flex; flex-direction: column; line-height: 1.2; }
.site-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.site-tagline { font-size: 11px; color: var(--text-secondary); }
.custom-logo { max-height: 44px; width: auto; }

.primary-navigation { flex: 1 1 auto; min-width: 0; }
.nav-menu { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-menu a {
	display: inline-block; padding: 10px 14px; border-radius: var(--radius-sm);
	color: var(--text); font-weight: 500; font-size: 14.5px;
}
.nav-menu a:hover { background: var(--bg-secondary); color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.search-toggle, .menu-toggle {
	background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
	width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
	color: var(--text);
}
.search-toggle:hover, .menu-toggle:hover { background: var(--bg-secondary); }
.menu-toggle { display: none; flex-direction: column; gap: 4px; }
.menu-toggle span { display: block; width: 18px; height: 2px; background: currentColor; }

.header-search {
	position: absolute; left: auto; right: 0; top: 68px;
	width: 320px; max-width: calc(100vw - 40px);
	background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
	padding: 14px; box-shadow: var(--shadow-hover); z-index: 600;
}
.header-search[hidden] { display: none; }
.search-form { display: flex; max-width: var(--container); margin: 0 auto; gap: 8px; }
.search-form input[type="search"] {
	flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15px;
}
.search-form button {
	padding: 10px 18px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 600;
}
.search-form button:hover { background: var(--accent-dark); }

/* Compact variant used only inside the header dropdown (404/search-page
   forms keep the larger size above). */
.header-search .search-form { max-width: none; margin: 0; gap: 6px; }
.header-search .search-form input[type="search"] { min-width: 0; padding: 8px 10px; font-size: 14px; }
.header-search .search-form button { padding: 8px 12px; font-size: 14px; }

/* ==========================================================================
   2. Hero / trending
   ========================================================================== */
.hero-section {
	display: grid; grid-template-columns: 2fr 1fr; gap: 28px;
	padding: 32px 20px 8px;
}
.hero-featured { position: relative; }
.hero-thumb { position: relative; display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; background: var(--bg-secondary); }
.hero-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.hero-thumb:hover img { transform: scale(1.03); }
.post-card-category {
	position: absolute; left: 14px; top: 14px;
	background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
	padding: 5px 12px; border-radius: 999px; letter-spacing: .02em;
}
a.post-card-category { position: static; display: inline-block; margin-bottom: 10px; }
.hero-body { padding-top: 18px; }
.hero-title { font-size: 30px; letter-spacing: -.01em; }
.hero-title a { color: var(--text); }
.hero-title a:hover { color: var(--accent); }
.hero-excerpt { color: var(--text-secondary); font-size: 16px; }

.post-card-meta { color: var(--text-secondary); font-size: 13.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.post-card-meta .dot { opacity: .6; }

.hero-trending {
	background: var(--bg-secondary); border-radius: var(--radius); padding: 20px;
}
.hero-trending .widget-title {
	font-size: 12.5px; font-weight: 800; letter-spacing: .14em; margin-bottom: 16px;
	color: var(--accent); text-transform: uppercase; display: flex; align-items: center; gap: 8px;
}
.hero-trending .widget-title::before {
	content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%;
	background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.trending-list li + li { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.trending-list a { display: flex; gap: 12px; align-items: flex-start; color: var(--text); }
.trending-rank { font-weight: 800; color: var(--accent); font-size: 15px; min-width: 18px; }
.trending-title { font-size: 14.5px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.trending-list a:hover .trending-title { color: var(--accent); }

/* ==========================================================================
   3. Layout / grid
   ========================================================================== */
.layout-with-sidebar { display: grid; grid-template-columns: 1fr 320px; gap: 40px; padding: 32px 20px 60px; }
.main-column { min-width: 0; }

.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-title { font-size: 21px; padding-left: 12px; border-left: 4px solid var(--accent); }
.section-more { font-size: 13.5px; font-weight: 600; white-space: nowrap; }

.post-grid {
	display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.post-card {
	display: flex; flex-direction: column; background: var(--bg);
	border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
	transition: box-shadow .25s ease, transform .25s ease;
}
.post-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.post-card-thumb { position: relative; aspect-ratio: 16/9; background: var(--bg-secondary); display: block; overflow: hidden; }
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-card-thumb-placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--accent-soft), var(--bg-secondary)); }
.post-card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-card-title { font-size: 16.5px; line-height: 1.5; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt { color: var(--text-secondary); font-size: 14px; margin: 0; }

/* "No posts" message inside a .post-grid would otherwise sit in the first
   grid column only, leaving a large empty gap before the sidebar. */
.post-grid > p {
	grid-column: 1 / -1; margin: 0; padding: 32px; text-align: center;
	color: var(--text-secondary); background: var(--bg-secondary); border-radius: var(--radius);
}

.category-section { margin-top: 48px; }

/* ==========================================================================
   4. Sidebar
   ========================================================================== */
.sidebar { display: flex; flex-direction: column; gap: 28px; }
.widget { padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.widget:last-child { border-bottom: none; }
.widget-title { font-size: 16px; margin-bottom: 14px; }

.popular-posts-list li + li { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.popular-post-item { display: flex; gap: 10px; align-items: center; color: var(--text); }
.popular-post-rank {
	flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark);
	font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center;
}
.popular-post-thumb { flex: 0 0 56px; width: 56px; height: 56px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-secondary); }
.popular-post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.popular-post-title { font-size: 13.5px; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.popular-post-item:hover .popular-post-title { color: var(--accent); }

.sidebar-cat-list li { display: flex; }
.sidebar-cat-list a {
	flex: 1; display: flex; justify-content: space-between; padding: 8px 0; color: var(--text); font-size: 14.5px;
}
.sidebar-cat-list a:hover { color: var(--accent); }
.sidebar-cat-list .count { color: var(--text-secondary); font-size: 13px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill {
	display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--bg-secondary);
	color: var(--text-secondary); font-size: 13px;
}
.tag-pill:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* In case a default WordPress "Search" block/widget is dropped into the
   sidebar widget area — keep it visually consistent instead of falling
   back to unstyled core markup (cramped input + wrapping button text). */
.wp-block-search__inside-wrapper { display: flex; gap: 8px; }
.wp-block-search__input {
	flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14.5px;
}
.wp-block-search__button {
	white-space: nowrap; padding: 10px 16px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 600;
}
.wp-block-search__button:hover { background: var(--accent-dark); }

/* ==========================================================================
   5. Breadcrumbs / pagination
   ========================================================================== */
.breadcrumbs { margin-bottom: 18px; font-size: 13px; color: var(--text-secondary); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: 6px; color: var(--border); }
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); }

.pagination { margin-top: 32px; }
.pagination ul { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px;
	border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; color: var(--text); font-size: 14px;
}
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { background: var(--bg-secondary); }

/* ==========================================================================
   6. Single post / page
   ========================================================================== */
.archive-header { margin-bottom: 24px; }
.archive-title { font-size: 20px; }
.archive-title span { color: var(--accent); }
.archive-description { color: var(--text-secondary); }

.single-header { margin-bottom: 20px; }
.single-title { font-size: 30px; line-height: 1.4; margin: 10px 0 14px; }
.single-meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--text-secondary); font-size: 13.5px; align-items: center; }
.single-thumb { margin: 0 0 24px; border-radius: var(--radius); overflow: hidden; }
.single-thumb figcaption { font-size: 13px; color: var(--text-secondary); padding: 8px 2px 0; }

.single-content { font-size: 17px; line-height: 1.9; }
.single-content h2 { font-size: 23px; margin-top: 2em; padding-left: 10px; border-left: 4px solid var(--accent); }
.single-content h3 { font-size: 19px; margin-top: 1.6em; }
.single-content img { border-radius: var(--radius-sm); margin: 1.2em 0; }
.single-content a { text-decoration: underline; text-decoration-color: var(--accent-soft); }
.single-content blockquote {
	margin: 1.6em 0; padding: 16px 20px; background: var(--bg-secondary); border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
	color: var(--text-secondary);
}
.single-content pre {
	background: #0f1117; color: #e6e6e6; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 14px;
}
.single-content code { background: var(--bg-secondary); padding: .15em .4em; border-radius: 4px; font-size: .92em; }
.single-content pre code { background: none; padding: 0; }
.single-content ul, .single-content ol { margin: 0 0 1.2em; padding-left: 1.4em; list-style: revert; }
.single-content table { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; }
.single-content table th, .single-content table td { padding: 8px 12px; border: 1px solid var(--border); white-space: nowrap; }

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }

.share-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 22px 0; }
.share-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; margin-right: 4px; }
.share-btn {
	display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
	background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border);
}
.share-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.related-posts { max-width: 760px; margin: 40px auto 0; }
.related-posts .post-grid { grid-template-columns: repeat(2, 1fr); }

/* ==========================================================================
   7. Footer
   ========================================================================== */
.site-footer { background: var(--bg-secondary); margin-top: 40px; border-top: 1px solid var(--border); padding-top: 36px; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; padding-bottom: 28px; }
.footer-cat-list a { display: block; padding: 4px 0; color: var(--text-secondary); font-size: 14px; }
.footer-cat-list a:hover { color: var(--accent); }
.footer-nav { border-top: 1px solid var(--border); padding: 18px 0; }
.footer-menu { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.footer-menu a { font-size: 13.5px; color: var(--text-secondary); }
.site-info { text-align: center; padding: 18px 0 28px; color: var(--text-secondary); font-size: 13px; }

/* ==========================================================================
   8. 404
   ========================================================================== */
.error-404 .search-form { margin: 20px 0 32px; max-width: 480px; }

/* ==========================================================================
   9. Responsive
   ========================================================================== */
@media (max-width: 980px) {
	.layout-with-sidebar { grid-template-columns: 1fr; }
	.sidebar { order: 2; }
	.hero-section { grid-template-columns: 1fr; }
	.post-grid { grid-template-columns: repeat(2, 1fr); }
	.footer-widgets { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
	.header-inner { height: 60px; gap: 12px; }
	.site-title { font-size: 18px; }
	.primary-navigation {
		position: fixed; inset: 60px 0 0 0; background: var(--bg); padding: 16px 20px; overflow-y: auto;
		transform: translateX(100%); transition: transform .25s ease; z-index: 400;
	}
	.primary-navigation.is-open { transform: translateX(0); }
	.nav-menu { flex-direction: column; gap: 2px; }
	.nav-menu a { padding: 14px; font-size: 16px; }
	.menu-toggle { display: flex; }
	.header-search { top: 60px; }
	.post-grid { grid-template-columns: 1fr; }
	.related-posts .post-grid { grid-template-columns: 1fr; }
	.hero-title { font-size: 23px; }
	.single-title { font-size: 24px; }
	.footer-widgets { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
	.header-actions { gap: 4px; }
	.share-buttons { gap: 6px; }
	.share-btn { padding: 7px 12px; font-size: 12px; }
}
