/*
 * dokkoisyo-timetable — frontend styles
 *
 * Two orientations driven by [data-orientation]:
 *  - vertical (default): time runs top→bottom, categories are columns
 *  - horizontal:         time runs left→right, categories are rows
 */

.dokkoisyo-tt-front {
	--ppm: 3px;            /* pixels per minute (3px = 90px / 30min) */
	--col-w: 220px;        /* vertical: width of each category column */
	--row-h: 110px;        /* horizontal: height of each category row */
	--axis-w: 56px;        /* width (vertical) / height (horizontal) of the time axis strip */
	--cat-h: 56px;         /* height of category header cells (vertical mode) */
	--cat-w: 140px;        /* width of category header cells (horizontal mode) */
	--header-offset: 130px; /* clears the theme's position:fixed .main-header */
	--ink: #230E0A;
	--rule: #BCBCBC;
	--stripe-a: #FFFFFF;
	--stripe-b: #F4F7FA;

	font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--ink);
	margin: 0 0 48px;
	/* テーマのヘッダー直下に配置されるため、固定ヘッダー分の上部余白を確保 */
	padding: var(--header-offset) 16px 32px;
	scroll-margin-top: var(--header-offset);
}

.dokkoisyo-tt-front *,
.dokkoisyo-tt-front *::before,
.dokkoisyo-tt-front *::after {
	box-sizing: border-box;
}

/* === Toolbar (axis swap button) ============================================== */
.dokkoisyo-tt-front__toolbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 12px;
}
.dokkoisyo-tt-front__swap {
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	color: var(--ink);
	background: #fff;
	border: 1px solid #BCBCBC;
	border-radius: 999px;
	padding: 6px 14px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.dokkoisyo-tt-front__swap:hover {
	background: #F4F7FA;
	border-color: #888;
}
.dokkoisyo-tt-front__swap:focus-visible {
	outline: 2px solid #40C4DF;
	outline-offset: 2px;
}
.dokkoisyo-tt-front__swap-icon {
	font-size: 16px;
	line-height: 1;
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__swap-icon {
	transform: rotate(90deg);
}

/* === Scroll container ======================================================== */
.dokkoisyo-tt-front__scroll {
	max-width: 100%;
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__scroll {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
}

/* === Grid skeleton (CSS Grid for orientation-driven layout) ================== */
.dokkoisyo-tt-front__grid {
	display: grid;
	min-width: fit-content;
	gap: 0;
}

/* Vertical: empty | cats | empty   /   axis-L | cols | axis-R */
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__grid {
	grid-template-columns: var(--axis-w) auto var(--axis-w);
	grid-template-rows: var(--cat-h) auto;
	grid-template-areas:
		".     cats  ."
		"axisL cols  axisR";
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__cats        { grid-area: cats; }
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__cols        { grid-area: cols; }
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__axis--start { grid-area: axisL; }
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__axis--end   { grid-area: axisR; }

/* Horizontal: empty | axisT   /   cats | cols   /   empty | axisB */
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__grid {
	grid-template-columns: var(--cat-w) auto;
	grid-template-rows: var(--axis-w) auto var(--axis-w);
	grid-template-areas:
		".    axisT"
		"cats cols"
		".    axisB";
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__cats        { grid-area: cats; }
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__cols        { grid-area: cols; }
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__axis--start { grid-area: axisT; }
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__axis--end   { grid-area: axisB; }

/* === Categories header ======================================================= */
.dokkoisyo-tt-front__cats {
	display: flex;
	gap: 4px;
}
.dokkoisyo-tt-front[data-orientation="vertical"]   .dokkoisyo-tt-front__cats { flex-direction: row; }
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__cats { flex-direction: column; }

.dokkoisyo-tt-front__cat {
	background: #fff;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	padding: 6px 12px;
	font-weight: 700;
	font-size: 14px;
	color: var(--ink);
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__cat {
	width: var(--col-w);
	flex-shrink: 0;
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__cat {
	height: var(--row-h);
	flex-shrink: 0;
	justify-content: center;
}
.dokkoisyo-tt-front__cat-bar {
	display: block;
	height: 4px;
	border-radius: 3px;
	background: var(--cat-color, #999);
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__cat-bar {
	height: auto;
	width: 4px;
	min-height: 28px;
	display: inline-block;
	margin-right: 8px;
	vertical-align: middle;
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__cat {
	flex-direction: row;
	align-items: center;
}

/* === Time axis =============================================================== */
.dokkoisyo-tt-front__axis {
	position: relative;
	background: transparent;
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__axis {
	height: calc(var(--total-min) * var(--ppm));
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__axis {
	width: calc(var(--total-min) * var(--ppm));
}

.dokkoisyo-tt-front__tick {
	position: absolute;
	font-size: 11px;
	color: #676767;
	white-space: nowrap;
	transform: translate(0, -50%);
}
.dokkoisyo-tt-front__tick.is-hour {
	color: var(--ink);
	font-weight: 700;
	font-size: 12px;
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__tick {
	top: calc(var(--tick-min) * var(--ppm));
	width: 100%;
	padding: 0 8px;
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__axis--start .dokkoisyo-tt-front__tick { text-align: right; }
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__axis--end   .dokkoisyo-tt-front__tick { text-align: left;  }

.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__tick {
	left: calc(var(--tick-min) * var(--ppm));
	transform: translate(-50%, 0);
	top: 50%;
	margin-top: -8px;
}

/* === Columns (the actual program area) ======================================= */
.dokkoisyo-tt-front__cols {
	display: flex;
	gap: 4px;
	position: relative; /* .tt-front__spans オーバーレイの基準 */
	width: fit-content; /* 子カテゴリー列の合計幅にピッタリ揃える（span オーバーレイがはみ出さないため） */
}
.dokkoisyo-tt-front[data-orientation="vertical"]   .dokkoisyo-tt-front__cols { flex-direction: row; }
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__cols { flex-direction: column; }

/* 全ルーム横断プログラム: cols 全体に絶対配置で覆う */
.dokkoisyo-tt-front__spans {
	position: absolute;
	inset: 0;
	pointer-events: none; /* コンテナ自体は透過 → 個別タイルのみ受ける */
	z-index: 3;           /* rules(2)より前、通常tileと同レベル */
}
.dokkoisyo-tt-front__tile--span {
	position: absolute;
	cursor: default;
	pointer-events: auto;
	background: var(--tile-color, #666);
	color: #fff;
	border-radius: 6px;
	box-shadow: 0 2px 6px -2px rgba(0,0,0,.15);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transform: none;
	transition: none;
}
.dokkoisyo-tt-front__tile--span:hover { transform: none; box-shadow: 0 2px 6px -2px rgba(0,0,0,.15); }
/* モーダル非表示タイル（クリック無反応）は通常タイルでもホバー効果を消す */
.dokkoisyo-tt-front__tile--nomodal { cursor: default; }
.dokkoisyo-tt-front__tile--nomodal:hover { transform: none; box-shadow:
	0 4px 16px -8px rgba(0, 0, 0, 0.06),
	0 2px 4px -2px rgba(0, 0, 59, 0.06); }
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__tile--span {
	left: 4px; right: 4px;
	top: calc(var(--start-min) * var(--ppm));
	height: calc(var(--duration-min) * var(--ppm));
	min-height: 28px; /* start==end のマーカー用途で最低高さを確保 */
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__tile--span {
	top: 4px; bottom: 4px;
	left: calc(var(--start-min) * var(--ppm));
	width: calc(var(--duration-min) * var(--ppm));
	min-width: 60px;
}

.dokkoisyo-tt-front__col {
	position: relative;
	flex-shrink: 0;
	background:
		repeating-linear-gradient(
			to bottom,
			var(--stripe-a) 0,
			var(--stripe-a) calc(var(--ppm) * 30),
			var(--stripe-b) calc(var(--ppm) * 30),
			var(--stripe-b) calc(var(--ppm) * 60)
		);
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__col {
	width: var(--col-w);
	height: calc(var(--total-min) * var(--ppm));
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__col {
	height: var(--row-h);
	width: calc(var(--total-min) * var(--ppm));
	background:
		repeating-linear-gradient(
			to right,
			var(--stripe-a) 0,
			var(--stripe-a) calc(var(--ppm) * 30),
			var(--stripe-b) calc(var(--ppm) * 30),
			var(--stripe-b) calc(var(--ppm) * 60)
		);
}

.dokkoisyo-tt-front__rule {
	position: absolute;
	pointer-events: none;
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__rule {
	left: 0;
	right: 0;
	top: calc(var(--rule-min) * var(--ppm));
	border-top: 1px dashed var(--rule);
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__rule {
	top: 0;
	bottom: 0;
	left: calc(var(--rule-min) * var(--ppm));
	border-left: 1px dashed var(--rule);
}

/* === Tile ==================================================================== */
.dokkoisyo-tt-front__tile {
	position: absolute;
	font: inherit;
	border: none;
	background: var(--tile-color, #999);
	color: #fff;
	border-radius: 8px;
	box-shadow:
		0 4px 16px -8px rgba(0, 0, 0, 0.06),
		0 2px 4px -2px rgba(0, 0, 59, 0.06);
	cursor: pointer;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 0;
	text-align: left;
	display: flex;
	flex-direction: column;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	/* スクロールバーは通常非表示（hover 時に表示） */
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.dokkoisyo-tt-front__tile::-webkit-scrollbar {
	width: 0;
	background: transparent;
}
.dokkoisyo-tt-front__tile:hover {
	scrollbar-width: thin;
}
.dokkoisyo-tt-front__tile:hover::-webkit-scrollbar {
	width: 4px;
}
.dokkoisyo-tt-front__tile:hover::-webkit-scrollbar-thumb {
	background: rgba(0,0,0,.25);
	border-radius: 2px;
}
.dokkoisyo-tt-front__tile:hover {
	transform: translateY(-1px);
	box-shadow:
		0 8px 24px -8px rgba(0, 0, 0, 0.18),
		0 3px 6px -2px rgba(0, 0, 59, 0.1);
}
.dokkoisyo-tt-front__tile:focus-visible {
	outline: 2px solid #40C4DF;
	outline-offset: 2px;
}
.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__tile {
	left: 4px;
	right: 4px;
	top: calc(var(--start-min) * var(--ppm));
	height: calc(var(--duration-min) * var(--ppm));
}
.dokkoisyo-tt-front[data-orientation="horizontal"] .dokkoisyo-tt-front__tile {
	top: 4px;
	bottom: 4px;
	left: calc(var(--start-min) * var(--ppm));
	width: calc(var(--duration-min) * var(--ppm));
}

.dokkoisyo-tt-front__tile-head {
	/* 背景色は親 .tile 側に統合したのでここでは指定なし */
	padding: 8px 12px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex-shrink: 0;
}
.dokkoisyo-tt-front__tile-time {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
	opacity: 0.92;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.dokkoisyo-tt-front__tile-nolate {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(214, 54, 56, 0.95);
	color: #fff;
	border-radius: 3px;
	padding: 1px 3px;
	line-height: 0;
}
.dokkoisyo-tt-front__modal-nolate {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: #d63638;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 3px;
	margin-left: 10px;
	vertical-align: middle;
}
.dokkoisyo-tt-front__modal-nolate svg {
	display: block;
}
.dokkoisyo-tt-front__modal-nolate-txt {
	line-height: 1;
}
.dokkoisyo-tt-front__tile-title {
	font-size: 12px;
	font-weight: 700;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}
/* 一覧では登壇者エリア（白いエリア）は非表示。詳細はモーダルで確認する */
.dokkoisyo-tt-front__tile-body {
	display: none;
}
/* 新: 登壇者リスト（2列グリッド）
   スクロールは .tile 側で行うためここでは overflow を指定しない */
.dokkoisyo-tt-front__tile-speakers {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px 10px;
}
.dokkoisyo-tt-front__tile-speaker-item {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;                       /* テキストの ellipsis を効かせる */
}
.dokkoisyo-tt-front__tile-speaker-avatar {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	background: #eaeaea;
	display: block;
}
.dokkoisyo-tt-front__tile-speaker-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.dokkoisyo-tt-front__tile-speaker-text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	line-height: 1.3;
}
.dokkoisyo-tt-front__tile-speaker-role {
	font-size: 10px;
	color: #888;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.dokkoisyo-tt-front__tile-speaker-name {
	font-size: 12px;
	color: #222;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 700;
}
/* 旧クラス互換（旧データがある場合に表示） */
.dokkoisyo-tt-front__tile-speaker {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	white-space: pre-line;
}

/* === Modal =================================================================== */
.dokkoisyo-tt-front__modal[hidden] { display: none; }
.dokkoisyo-tt-front__modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.dokkoisyo-tt-front__modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(35, 14, 10, 0.6);
	cursor: pointer;
}
.dokkoisyo-tt-front__modal-panel {
	position: relative;
	background: #fff;
	border-radius: 12px;
	max-width: 640px;
	width: 100%;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.4);
	padding: 32px 28px 28px;
}
.dokkoisyo-tt-front__modal-close {
	position: absolute;
	top: 8px;
	right: 8px;
	background: transparent;
	border: none;
	font-size: 28px;
	line-height: 1;
	color: #676767;
	cursor: pointer;
	padding: 4px 12px;
}
.dokkoisyo-tt-front__modal-close:hover { color: #230E0A; }
.dokkoisyo-tt-front__modal-content {}

.dokkoisyo-tt-front__modal-tag {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	margin-bottom: 8px;
	background: var(--cat-color, #999);
}
.dokkoisyo-tt-front__modal-time {
	font-size: 14px;
	font-weight: 700;
	color: #4A4A4A;
	margin-bottom: 4px;
}
.dokkoisyo-tt-front__modal-title {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.3;
	margin: 0 0 16px;
	color: var(--ink);
}
.dokkoisyo-tt-front__modal-thumb {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: 8px;
	margin: 0 0 16px;
	background: #F4F7FA;
}
.dokkoisyo-tt-front__modal-speaker {
	background: #F4F7FA;
	border-radius: 6px;
	padding: 10px 14px;
	font-size: 13px;
	font-weight: 600;
	white-space: pre-line;
	margin-bottom: 16px;
}
/* 新: モーダル 登壇者リスト（タイトル直下、横並び、はみ出しで折り返し） */
.dokkoisyo-tt-front__modal-speakers {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 20px;
	margin: -8px 0 20px;
}
.dokkoisyo-tt-front__modal-speaker-item {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}
.dokkoisyo-tt-front__modal-speaker-avatar {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	overflow: hidden;
	background: #eaeaea;
	display: block;
}
.dokkoisyo-tt-front__modal-speaker-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.dokkoisyo-tt-front__modal-speaker-text {
	display: flex;
	flex-direction: column;
	line-height: 1.35;
	min-width: 0;
}
.dokkoisyo-tt-front__modal-speaker-role {
	font-size: 11px;
	color: #888;
}
.dokkoisyo-tt-front__modal-speaker-name {
	font-size: 14px;
	color: #222;
	font-weight: 700;
}
.dokkoisyo-tt-front__modal-description {
	font-size: 14px;
	line-height: 1.7;
	color: #444;
}
.dokkoisyo-tt-front__modal-description p { margin: 0 0 0.8em; }

/* === Mobile (basic, full mobile work in Phase 5) ============================= */
@media (max-width: 768px) {
	.dokkoisyo-tt-front {
		--header-offset: 80px;
	}
}

@media (max-width: 640px) {
	.dokkoisyo-tt-front {
		--col-w: 40vw;
		--row-h: 90px;
		--cat-w: 110px;
		/* SP は --header-offset:80px を上部に確保（ヘッダー直下との被り防止） */
		padding: var(--header-offset) 8px 24px;
	}
	.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__scroll {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
	/* SP: 横スクロール可能はバウンスアニメだけで示唆する。
	   （左右のグラデオーバーレイはカラーバーと衝突するので廃止） */
	.dokkoisyo-tt-front__scroll-wrap {
		position: relative;
	}
	/* 読込時に一度だけ右→左→戻る のバウンスで横スクロール可能を示す */
	.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__grid {
		animation: dokkoisyo-tt-scroll-hint 1.4s cubic-bezier(.22, .8, .3, 1) 0.6s 1;
	}
	@keyframes dokkoisyo-tt-scroll-hint {
		0%   { transform: translateX(0); }
		35%  { transform: translateX(-36px); }
		70%  { transform: translateX(0); }
		100% { transform: translateX(0); }
	}
	@media (prefers-reduced-motion: reduce) {
		.dokkoisyo-tt-front[data-orientation="vertical"] .dokkoisyo-tt-front__grid { animation: none; }
	}
	/* SPではタイトルを気持ち大きく */
	.dokkoisyo-tt-front__tile-title {
		font-size: 14px;
		line-height: 1.3;
	}
	.dokkoisyo-tt-front__modal {
		padding: 0;
	}
	.dokkoisyo-tt-front__modal-panel {
		max-height: 100vh;
		border-radius: 0;
	}
}
