/*
Theme Name: Convention Theme
Theme URI: https://example.com/convention-theme
Author: Convention Plus
Author URI: https://example.com
Description: 学会・研究会・講習会のサイトで共通に使うマルチ学会テーマ。プラグイン不要で動作し、環境非依存を実現。左サイドメニュー型のレイアウトに、公開済みページの予約更新・ブロックエディタ対応を備える。
Version: 2.2.0
Requires at least: 6.0
Tested up to: 6.9.1
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: convention-theme
Tags: custom-menu, custom-logo, editor-style, featured-images, full-width-template, block-styles, wide-blocks, accessibility-ready

Convention Theme is a WordPress theme shared by academic society, study group and
training course sites run by Convention Plus. Designed with plugin independence
and environment-agnostic principles. Formerly "Biman Theme" (biman-theme).
*/

/* ==========================================================================
   デザイントークン

   66vaq の coursedoc-theme から移植した資料ビューア・パスワード入力フォーム・
   メディア管理の CSS は、色や角丸を --convention-* の変数で受け取る。
   このテーマの配色（黒のクローム、白い本文面、アクセント #007bff）に
   合わせた値をここで決める。個別のセレクタに色を直書きしない。

   アクセント色はカスタマイザーの「メインカラー」（--convention-primary、
   inc/theme-customizer.php が出力）に追従する。
   ========================================================================== */

:root {
	/* 本文領域の幅。.site-container 1260px からサイドメニュー 260px を引いた値 */
	--convention-content-width: 1000px;
	/* 長い文章のための本文幅（資料ビューアの説明文などが参照する） */
	--convention-text-width: 46rem;
	/* 左右の余白。本文カード（article）の 2em に合わせる */
	--convention-gutter: 2em;

	--convention-color-bg: #999999;
	--convention-color-surface: #ffffff;
	/* 本文の中で沈めたい箇所（引用・補足・表の見出し）に敷く */
	--convention-color-sunk: #f5f5f5;
	--convention-color-text: #333333;
	--convention-color-muted: #666666;
	--convention-color-border: #e0e0e0;
	--convention-color-accent: var(--convention-primary, #007bff);
	--convention-color-accent-dark: #0056b3;

	/* ボタン・入力・箱で共通に使う角の丸み。テーマの .btn と同じ 4px */
	--convention-radius: 4px;
	--convention-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);

	--convention-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   基本リセットとタイポグラフィ
   ========================================================================== */

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 1rem;
	line-height: 1.6;
	color: #333;
	background-color: #999;
}

/* ==========================================================================
   レイアウト構造
   ========================================================================== */

.site-container {
	display: flex;
	min-height: 100vh;
	flex-direction: column;
	max-width: 1260px;
	margin: 0 auto;
	width: 100%;
	background-color: #1a1a1a;
}

.site-header {
	background-color: #1a1a1a;
	border-bottom: 1px solid #333;
	padding: 1rem 2rem;
}

.site-header.front-page-header {
	display: none;
}

.site-header .site-title a {
	color: #fff;
	text-decoration: none;
}

.site-header .site-description {
	color: #e0e0e0;
}

.main-navigation {
	background-color: #1a1a1a;
	color: #fff;
}

.menu-toggle[hidden] {
	display: none;
}

.menu-toggle {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	display: none;
	align-items: center;
	justify-content: center;
	color: #fff;
}

.menu-icon {
	display: block;
	width: 24px;
	height: 2px;
	background-color: #fff;
	position: relative;
}

.menu-icon::before,
.menu-icon::after {
	content: '';
	position: absolute;
	width: 24px;
	height: 2px;
	background-color: #fff;
	left: 0;
}

.menu-icon::before {
	top: -8px;
}

.menu-icon::after {
	top: 8px;
}

.site-content-wrapper {
	display: flex;
	flex: 1;
	flex-wrap: nowrap;
	align-items: flex-start;
	width: 100%;
}

.sidebar {
	width: 260px;
	min-width: 260px;
	flex-shrink: 0;
	background-color: #1a1a1a;
	border-right: 1px solid #333;
	position: sticky;
	top: 0;
	align-self: flex-start;
	max-height: 100vh;
	overflow-y: auto;
	overflow-x: hidden;

	/* スクロールバーはメニューの一部として見せる。
	   黒い面に白い文字のメニューに、ブラウザ既定の明るく太いバーは浮く。
	   細くして面と同じ色調にし、触れているときだけつまみをはっきり出す。
	   scrollbar-width / scrollbar-color は Firefox と Chrome 121 以降、
	   ::-webkit-scrollbar は Safari と古い Chrome 向け。両方書いておく。 */
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar:hover,
.sidebar:focus-within {
	scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

.sidebar::-webkit-scrollbar {
	width: 6px;
}

.sidebar::-webkit-scrollbar-track {
	background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
	background-color: rgba(255, 255, 255, 0.18);
	border-radius: 3px;
	transition: background-color 0.2s ease;
}

.sidebar:hover::-webkit-scrollbar-thumb,
.sidebar:focus-within::-webkit-scrollbar-thumb {
	background-color: rgba(255, 255, 255, 0.4);
}

.site-main {
	flex: 1;
	min-width: 0;
	padding: 0;
	max-width: 100%;
	width: 100%;
	background-color: #fff;
}

.site-main.front-page {
	padding: 0;
}

.site-footer {
	background-color: #1a1a1a;
	color: #fff;
	padding: 2rem;
	text-align: center;
}

/* ==========================================================================
   サイドメニュー（260px幅、各ボタン80px高さ）
   ========================================================================== */

.sidebar-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	width: 100%;
	max-width: 100%;
}

.sidebar-menu li {
	height: 80px;
	border-bottom: 1px solid #333;
}

.sidebar-menu a {
	display: flex;
	align-items: center;
	padding: 0 1.5rem;
	height: 100%;
	color: #fff;
	text-decoration: none;
	transition: background-color 0.3s ease;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sidebar-menu a:hover,
.sidebar-menu a:focus {
	background-color: #333;
}

.sidebar-menu .current-menu-item a,
.sidebar-menu .current_page_item a {
	background-color: #007bff;
	color: #fff;
}

/* ==========================================================================
   レスポンシブ対応
   ========================================================================== */

/* タブレット以下 (991.98px以下) */
@media (max-width: 991.98px) {
	.site-header.front-page-header {
		display: block;
		padding: 0.5rem 1rem;
	}

	.menu-toggle {
		display: inline-flex;
	}

	.site-content-wrapper {
		flex-direction: column;
		flex-wrap: wrap;
	}

	.sidebar {
		width: 100%;
		min-width: 100%;
		border-right: none;
		border-bottom: 1px solid #333;
		position: relative;
		max-height: none;
		overflow: visible;
	}

	/* 畳むのは JS が動くとき（html.js）だけ。
	   JS が無い環境で畳むと、開くボタンも働かず、メニューに一切たどり着けない。 */
	.js .sidebar {
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease-in-out;
	}

	.js .sidebar.active {
		max-height: 1000px;
		overflow-y: auto;
	}

	.sidebar-menu li {
		height: 60px;
	}

	.site-main {
		width: 100%;
	}
}

/* モバイル (768px以下) */
@media (max-width: 768px) {
	.site-header.front-page-header {
		display: block;
		padding: 0.5rem 1rem;
	}

	.menu-toggle {
		display: inline-flex;
	}

	.site-content-wrapper {
		flex-direction: column;
		flex-wrap: wrap;
	}

	.sidebar {
		width: 100%;
		min-width: 100%;
		border-right: none;
		border-bottom: 1px solid #333;
		position: relative;
		max-height: none;
		overflow: visible;
	}

	/* 畳むのは JS が動くとき（html.js）だけ。
	   JS が無い環境で畳むと、開くボタンも働かず、メニューに一切たどり着けない。 */
	.js .sidebar {
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease-in-out;
	}

	.js .sidebar.active {
		max-height: 1000px;
		overflow-y: auto;
	}

	.sidebar-menu li {
		height: 60px;
	}

	.site-main {
		padding: 1rem;
		width: 100%;
	}
}

/* ==========================================================================
   アクセシビリティ
   ========================================================================== */

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	clip: auto !important;
	color: #fff;
	display: block;
	font-size: 16px;
	font-weight: bold;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
	border: 2px solid #fff;
}
