/*
Theme Name: KIPCENTER
Theme URI: https://kipcenter.xbiz.jp/
Author: SODA
Description: 倉敷市児島産業振興センターの静的サイト（index.html）から起こしたオリジナルテーマ。デザインの本体はサイト直下の /css/style.css を共用し、このテーマには WordPress が出すマークアップ用の追補だけを置いている。
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 8.0
License: 制作者および発注者の専用（再配布不可）
Text Domain: kipcenter
*/

/* ==================================================================
 * このファイルについて
 *
 * サイトの見た目は、静的サイトと同じ /css/style.css（約 9,000 行）を
 * そのまま読み込んで使っている。ここに書くのは、
 *   ・WordPress だけが出すマークアップ（管理バー・ページャー・本文）
 *   ・静的サイト側には存在しない要素
 * のための追補に限る。サイト全体のデザインを変えるときは
 * /css/style.css のほうを直す（ここに複製を作らない）。
 * ================================================================ */

/* ------------------------------------------------------------------
 * 01. 管理バー（ログイン中だけ出る 32px / 46px の黒帯）
 *     ヘッダーは position: sticky; top: 0 なので、そのままだと帯の下に潜る。
 * ---------------------------------------------------------------- */
body.admin-bar .header {
	top: 32px;
}

@media (max-width: 1080px) {
	/* ドロワーは position: fixed なので、上端と高さの両方をずらす */
	body.admin-bar .gnav {
		margin-top: 32px;
		max-height: calc(100dvh - var(--gnav-top) - 32px);
	}
}

@media screen and (max-width: 782px) {
	body.admin-bar .header {
		top: 46px;
	}

	body.admin-bar .gnav {
		margin-top: 46px;
		max-height: calc(100dvh - var(--gnav-top) - 46px);
	}
}

/* ------------------------------------------------------------------
 * 02. WordPress 標準のクラス
 * ---------------------------------------------------------------- */

/* 読み上げ専用のテキスト（ページャーの見出しなどに付く） */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.screen-reader-text:focus {
	z-index: 1000;
	top: 8px;
	left: 8px;
	width: auto;
	height: auto;
	margin: 0;
	padding: 10px 16px;
	clip-path: none;
	background: #fff;
	color: var(--navy);
	border-radius: 8px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.alignleft {
	float: left;
	margin: .3em 1.4em 1em 0;
}

.alignright {
	float: right;
	margin: .3em 0 1em 1.4em;
}

.aligncenter {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.alignwide,
.alignfull {
	max-width: 100%;
}

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

.wp-caption-text,
.wp-element-caption,
figcaption {
	margin-top: .5em;
	font-size: var(--fs-sm);
	color: var(--muted);
	text-align: center;
}

.sticky .news-post,
.news-post.sticky {
	border-color: var(--blue);
}

/* ------------------------------------------------------------------
 * 03. 一覧まわり（静的サイトの news.html との差を埋める）
 * ---------------------------------------------------------------- */

/* 絞り込みは静的サイトでは <button> だったが、
   WordPress ではカテゴリーへのリンクになる。見た目をそろえる。 */
body.page-news .news-filter a {
	display: inline-block;
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 8px 14px;
	background: #fff;
	color: var(--muted);
	font-size: var(--fs-sm);
	font-weight: 700;
	transition: .2s;
}

body.page-news .news-filter a:hover,
body.page-news .news-filter a.active {
	border-color: var(--blue);
	background: var(--blue);
	color: #fff;
}

/* 一覧の見出しはリンクになる */
body.page-news .news-post h2 a {
	color: inherit;
	transition: color .2s;
}

body.page-news .news-post h2 a:hover {
	color: var(--blue);
}

/* アイキャッチ画像は枠いっぱいに収める */
body.page-news .news-body-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 本文中の画像がはみ出さないように */
body.page-news .news-body img,
body.site-subpage .entry-body img {
	max-width: 100%;
	height: auto;
}

/* the_posts_pagination() は中身を .nav-links で包むので、
   並べる役を内側に移す（外側の .news-pagination は箱だけにする） */
body.page-news .news-pagination .nav-links {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
}

body.page-news .news-pagination:has(.nav-links) {
	display: block;
}

/* 「一覧へ戻る」のような文字数のあるボタン */
body.page-news .news-pagination a.is-wide {
	width: auto;
	padding: 0 18px;
	border-radius: 999px;
}

body.page-news .news-pagination a:hover {
	border-color: var(--blue);
	color: var(--blue);
}

/* 検索フォーム（404 と検索結果で使う） */
body.site-subpage .search-form {
	display: flex;
	gap: 8px;
	max-width: 420px;
}

body.site-subpage .search-form label {
	flex: 1 1 auto;
}

body.site-subpage .search-form .search-field {
	width: 100%;
	padding: 9px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: #fff;
	font: inherit;
	font-size: var(--fs-sm);
}

body.site-subpage .search-form .search-submit {
	padding: 9px 18px;
	border: 1px solid var(--blue);
	border-radius: 999px;
	background: var(--blue);
	color: #fff;
	font: inherit;
	font-size: var(--fs-sm);
	font-weight: 700;
	cursor: pointer;
}

/* ------------------------------------------------------------------
 * 04. 本文（固定ページ・投稿詳細）
 *     静的サイトの .policy-body と同じ調子にそろえたうえで、
 *     エディターから出てくる要素（表・引用・画像）を足している。
 * ---------------------------------------------------------------- */
body.site-subpage .entry-body {
	font-size: var(--fs-base);
	line-height: 1.9;
}

body.site-subpage .entry-body > *:first-child {
	margin-top: 0;
}

body.site-subpage .entry-body h2 {
	margin: 2.2em 0 .7em;
	font-family: var(--serif);
	font-size: var(--fs-xl);
	line-height: 1.5;
	font-weight: 600;
	color: var(--navy);
}

body.site-subpage .entry-body h3 {
	margin: 2em 0 .6em;
	padding-left: .7em;
	border-left: 4px solid var(--blue);
	font-size: var(--fs-lg);
	line-height: 1.5;
	color: var(--navy);
}

body.site-subpage .entry-body h4 {
	margin: 1.6em 0 .5em;
	font-size: var(--fs-base);
	font-weight: 700;
	color: var(--navy);
}

body.site-subpage .entry-body p {
	margin-top: .6em;
	line-height: 1.9;
}

body.site-subpage .entry-body ul,
body.site-subpage .entry-body ol {
	margin: .6em 0 0 1.4em;
}

body.site-subpage .entry-body ul {
	list-style: disc;
}

body.site-subpage .entry-body ol {
	list-style: decimal;
}

body.site-subpage .entry-body li {
	line-height: 1.9;
}

body.site-subpage .entry-body a {
	color: var(--blue);
	text-decoration: underline;
}

body.site-subpage .entry-body blockquote {
	margin: 1.4em 0;
	padding: 2px 0 2px 1.2em;
	border-left: 4px solid var(--line);
	color: var(--muted);
}

body.site-subpage .entry-body table {
	width: 100%;
	margin: 1.4em 0;
	border-collapse: collapse;
	font-size: var(--fs-sm);
}

body.site-subpage .entry-body th,
body.site-subpage .entry-body td {
	padding: 10px 14px;
	border: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

body.site-subpage .entry-body th {
	background: var(--blue-pale);
	color: var(--navy);
	font-weight: 700;
	white-space: nowrap;
}

body.site-subpage .entry-body figure {
	margin: 1.4em 0;
}

body.site-subpage .entry-body hr {
	margin: 2em 0;
	border: 0;
	border-top: 1px solid var(--line);
}
