/* ==========================================================================
   okikeisuke theme
   ブレークポイント: 〜700px(スマホ) / 〜1500px(タブレット・ノートPC) / それ以上
   メディアクエリでは差分だけを上書きする。
   ========================================================================== */

:root {
	--c-bg: rgb(0 0 25);
	--c-text: #fff;
	--c-text-muted: rgb(255 255 255 / 0.5);
	--c-text-faint: rgb(255 255 255 / 0.1);
	--c-panel: rgb(0 0 0 / 0.5);
	--c-menu: rgb(0 0 10 / 0.92); /* 0.8だと下の本文が透けてメニュー項目が読みにくかった */
	--c-toggle: rgb(50 50 50 / 0.3);
	--c-accent: #152c42;

	--f-display: "DM Serif Display", serif;
	--f-body: "Noto Serif JP", serif;
	--f-ui: Arial, sans-serif;

	--rule-double: 3px double var(--c-text);
	--rule-dashed: 1px dashed var(--c-text-muted);

	--panel-width: min(1000px, 70vw);
	--panel-padding: 40px;
	--panel-font-size: 1.2em;

	--hero-font-size: clamp(30px, 15vh, 120px);
	--hero-top: 14vh;
	--hero-left: 13%;
	--hero-row: 16%;
	--hero-indent: 16vmin;
	--hero-image-height: clamp(600px, 40vw, 800px);

	--nav-font-size: clamp(25px, 3.5vw, 40px);
}

/* ---------- base ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
	background-color: var(--c-bg);
	color: var(--c-text);
	font-family: var(--f-ui);
	font-size: 13px;
}

a {
	color: inherit;
}

a:focus-visible,
button:focus-visible {
	outline: 2px solid var(--c-text);
	outline-offset: 3px;
}

img {
	max-width: 100%;
	height: auto;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed !important;
	top: 8px;
	left: 8px;
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: 0.6em 1em;
	clip-path: none;
	background: var(--c-text);
	color: var(--c-bg);
}

/* ---------- 背景演出 ---------- */

.particles {
	position: fixed;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	pointer-events: none;
}

.sidebar {
	position: fixed;
	inset: 0 auto 0 0;
	z-index: 1;
	width: 9vw;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--c-text-faint);
	pointer-events: none;
	user-select: none;
}

.sidebar-text {
	white-space: nowrap;
	font-family: var(--f-display);
	font-size: 7vw;
	transform: rotate(90deg) scaleY(2.5);
	animation: sidebar-scroll 120s linear infinite;
}

@keyframes sidebar-scroll {
	from {
		transform: rotate(90deg) scaleY(2.5) translateX(10%);
	}
	to {
		transform: rotate(90deg) scaleY(2.5) translateX(-4.3%);
	}
}

/* ---------- レイアウト ---------- */

.site {
	flex: 1;
	position: relative;
	transition: opacity 1s ease;
}

.site.is-leaving {
	opacity: 0;
}

.site-main {
	padding: 1em;
}

/* ---------- ナビゲーション ---------- */

.site-header {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 3;
}

.menu-toggle {
	display: none;
}

.nav-list {
	margin: 2em clamp(50px, 2vw, 80px) 0 0;
	padding: 0;
	list-style: none;
	text-align: right;
	font-family: var(--f-display);
	font-size: var(--nav-font-size);
}

.nav-list a {
	text-decoration: none;
	line-height: 2;
	transition: opacity 0.3s ease;
}

.nav-list a:hover {
	opacity: 0.7;
}

/* JS が動く環境でだけ、順番に出てくる演出のために最初は隠す */
.js .nav-list > li {
	opacity: 0;
	transform: translateY(50px);
	transition: opacity 1s ease, transform 1s ease;
}

.js .nav-list > li.is-shown {
	opacity: 1;
	transform: none;
}

/* ---------- フッター ---------- */

/* 固定配置にすると、スクロールするページで本文に重なるため通常配置にする。
   body が min-height: 100vh の縦flexなので、内容が短いページでも画面下端に来る。 */
.site-footer {
	position: relative;
	z-index: 1;
	display: flex;
	justify-content: flex-end;
	padding: 0.4em 2em;
}

.site-footer p {
	margin: 0;
}

/* ---------- トップページ ---------- */

.hero-words {
	position: fixed;
	top: var(--hero-top);
	left: var(--hero-left);
	z-index: 0;
	width: 80%;
	height: min(100%, 800px);
	margin: 0;
	overflow: hidden;
	color: var(--c-text-muted);
	font-family: var(--f-display);
	font-size: var(--hero-font-size);
	user-select: none;
}

.reveal-word {
	position: absolute;
	top: calc(var(--i) * var(--hero-row));
	left: calc(var(--i) * var(--hero-indent));
}

.reveal-word:nth-child(1) { --i: 0; }
.reveal-word:nth-child(2) { --i: 1; }
.reveal-word:nth-child(3) { --i: 2; }
.reveal-word:nth-child(4) { --i: 3; }

.js .reveal-word {
	opacity: 0;
	transform: translateX(50px);
	transition: opacity 1s ease, transform 1s ease;
}

.js .reveal-word.is-shown {
	opacity: 1;
	transform: none;
}

.hero-image {
	position: fixed;
	right: 0;
	bottom: 0;
	z-index: 0;
	width: auto;
	max-width: none;
	height: var(--hero-image-height);
}

.js .hero-image {
	opacity: 0;
	transition: opacity 6s ease;
}

.is-ready .hero-image {
	opacity: 1;
}

/* ---------- パネル(about / works 共通) ---------- */

.panel {
	position: relative;
	z-index: 2;
	width: var(--panel-width);
	margin: 40px auto;
	padding: var(--panel-padding);
	background-color: var(--c-panel);
	font-family: var(--f-body);
	font-size: var(--panel-font-size);
	line-height: 1.5;
}

.js .panel {
	opacity: 0;
	transition: opacity 3s ease;
}

.is-ready .panel {
	opacity: 1;
}

.panel-heading {
	margin: 0;
	border-top: var(--rule-double);
	border-bottom: var(--rule-double);
	font-family: var(--f-display);
	font-size: 30px;
	font-weight: 400;
	line-height: 2;
	text-align: center;
}

.button {
	display: inline-block;
	padding: 5px 25px;
	background: var(--c-accent);
	color: var(--c-text);
	line-height: 1.4;
	text-decoration: none;
	transition: background-color 0.3s, color 0.3s;
}

.button:hover,
.button:focus-visible {
	background: var(--c-text);
	color: var(--c-accent);
}

/* ---------- 固定ページ本文(about) ---------- */

.prose {
	margin: 0 30px;
	overflow-wrap: anywhere;
}

.prose > :first-child {
	margin-top: 0;
}

.prose > :last-child {
	margin-bottom: 0;
}

.prose h2 {
	font-size: 1.5em;
	line-height: 1.4;
}

.prose hr {
	margin: 1.5em -30px;
	border: 0;
	border-top: var(--rule-double);
}

/* プロフィール表(ブロックエディタの「テーブル」ブロック) */
.prose figure.wp-block-table {
	margin: 1.5em -30px;
}

.prose table {
	width: 100%;
	border: 0;
	border-collapse: collapse;
}

/* WordPress が出力するテーブルブロックの既定の罫線(全セルの枠線)を打ち消す */
.prose .wp-block-table td,
.prose .wp-block-table th,
.prose .wp-block-table thead,
.prose .wp-block-table tfoot {
	border: 0;
}

.prose tr {
	border-top: var(--rule-double);
	border-bottom: var(--rule-double);
}

.prose td,
.prose th {
	padding: 1em 0;
	vertical-align: top;
	text-align: left;
	font-weight: 400;
}

.prose td:first-child,
.prose th:first-child {
	width: 120px;
	padding-right: 40px;
	text-align: right;
	white-space: nowrap;
}

.prose .wp-block-embed__wrapper iframe,
.prose iframe {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}

/* ---------- works ---------- */

.works-list {
	border-bottom: var(--rule-double);
}

.work {
	padding: 1.5em 0;
	text-align: center;
}

.work + .work::before {
	content: "";
	display: block;
	width: 90%;
	margin: -1.5em auto 1.5em;
	border-top: var(--rule-dashed);
	border-bottom: var(--rule-dashed);
}

.work__title {
	margin: 0 0 0.8em;
	font-size: 1.1em;
	font-weight: 700;
	line-height: 1.5;
}

.work__media {
	max-width: 640px;
	margin: 0 auto 1em;
}

.work__media iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
}

.work__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6em;
	margin: 0 0 1em;
	padding: 0;
	list-style: none;
}

.work__details {
	margin: 0;
}

.work__details dt {
	font-weight: 700;
	text-decoration: underline;
}

.work__details dd {
	margin: 0 0 0.5em;
}

.works-empty,
.works-back {
	margin: 1.5em 0 0;
	text-align: center;
}

/* ---------- apps ---------- */

/* 「アプリを開く」は各カードの主な操作なので、詳しく見るより目立たせる */
.button--strong {
	background: var(--c-text);
	color: var(--c-accent);
	font-weight: 700;
}

.button--strong:hover,
.button--strong:focus-visible {
	background: var(--c-accent);
	color: var(--c-text);
}

.apps-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2em;
	padding: 2em 0;
	border-bottom: var(--rule-double);
}

.app-card {
	display: flex;
	flex-direction: column;
	border: var(--rule-dashed);
}

/* スクショ未設定のカードは、隣のカードの高さに引き伸ばされて大きな空白ができないようにする */
.app-card:not(:has(.app-card__media)) {
	align-self: start;
}

.app-card__media {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	border-bottom: var(--rule-dashed);
}

.app-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top;
	transition: opacity 0.3s;
}

.app-card__media:hover .app-card__img {
	opacity: 0.8;
}

.app-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 1em 1.2em 1.2em;
	text-align: center;
}

.app-card__title {
	margin: 0 0 0.5em;
	font-size: 1.1em;
	font-weight: 700;
	line-height: 1.5;
	/* カードは枠線で囲んでいるので、区切りの無い長い英字名が枠の外へはみ出さないようにする */
	overflow-wrap: anywhere;
}

.app-card__title a {
	text-decoration: none;
}

.app-card__title a:hover {
	text-decoration: underline;
}

.app-card__summary {
	margin: 0 0 0.8em;
}

/* ボタンはカードの下端に揃える(説明文の長さが違っても並びがずれないように) */
.app-card__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6em;
	margin: auto 0 0;
	padding-top: 0.6em;
}

.tech-list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.4em;
	margin: 0 0 0.8em;
	padding: 0;
	list-style: none;
	font-family: var(--f-ui);
	font-size: 0.75em;
}

.tech-list li {
	padding: 0.2em 0.7em;
	border: 1px solid var(--c-text-muted);
	border-radius: 999px;
}

.app-pending {
	display: inline-block;
	padding: 5px 25px;
	border: var(--rule-dashed);
	color: var(--c-text-muted);
	line-height: 1.4;
}

.app {
	padding: 1.5em 0;
	text-align: center;
}

.app__title {
	margin: 0 0 0.8em;
	font-size: 1.3em;
	font-weight: 700;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

.app__media {
	max-width: 800px;
	margin: 0 auto 1em;
}

.app__img {
	display: block;
	width: 100%;
	border: var(--rule-dashed);
}

.app__summary {
	margin: 0 0 0.8em;
}

.app__open {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4em;
	margin: 0 0 1.5em;
}

.app-open-note {
	color: var(--c-text-muted);
	font-family: var(--f-ui);
	font-size: 0.75em;
}

.app__content {
	padding-top: 1.5em;
	border-top: var(--rule-dashed);
	text-align: left;
}

.app__content .wp-block-image {
	margin: 1.5em 0;
}

.app__content .wp-block-image img {
	border: var(--rule-dashed);
}

.app__content figcaption {
	margin-top: 0.4em;
	color: var(--c-text-muted);
	font-size: 0.85em;
	text-align: center;
}

/* ==========================================================================
   〜1500px
   ========================================================================== */

@media (max-width: 1500px) {
	:root {
		--panel-width: min(1000px, 80vw);
		--hero-font-size: clamp(30px, 10vh, 120px);
		--hero-indent: 5vmin;
		--hero-image-height: clamp(500px, 55vw, 600px);
	}
}

/* ==========================================================================
   〜700px(スマホ)
   ========================================================================== */

@media (max-width: 700px) {
	:root {
		--panel-width: 90vw;
		--panel-padding: 24px 18px;
		--panel-font-size: 14px;
		--hero-font-size: clamp(30px, 8vh, 120px);
		--hero-top: 10vh;
		--hero-left: 20%;
		--hero-row: 12%;
		--hero-indent: 0vmin;
		--hero-image-height: clamp(300px, 90vw, 500px);
		--nav-font-size: 25px;
	}

	.site-footer {
		font-size: 0.8em;
	}

	.apps-list {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.5em;
	}

	/* ハンバーガーボタン */
	.menu-toggle {
		position: fixed;
		top: 15px;
		right: 15px;
		z-index: 4;
		display: block;
		width: 50px;
		height: 50px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background-color: var(--c-toggle);
		cursor: pointer;
	}

	.menu-toggle__bar {
		position: absolute;
		left: 20%;
		width: 60%;
		height: 2px;
		background-color: var(--c-text);
		transition: transform 0.5s, opacity 0.5s, top 0.5s;
	}

	.menu-toggle__bar:nth-child(1) { top: 30%; }
	.menu-toggle__bar:nth-child(2) { top: 50%; }
	.menu-toggle__bar:nth-child(3) { top: 70%; }

	.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
		top: 50%;
		transform: rotate(45deg);
	}

	.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
		opacity: 0;
	}

	.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
		top: 50%;
		transform: rotate(-45deg);
	}

	/* スライドメニュー。閉じている間は visibility で隠し、キーボード操作で入り込まないようにする */
	.site-nav {
		position: fixed;
		inset: 0 0 0 auto;
		z-index: 3;
		width: 130px;
		background-color: var(--c-menu);
		transform: translateX(100%);
		visibility: hidden;
		transition: transform 0.5s, visibility 0s 0.5s;
	}

	.site-nav.is-open {
		transform: none;
		visibility: visible;
		transition: transform 0.5s, visibility 0s;
	}

	.nav-list {
		margin: 90px 30px 0 0;
	}

	/* スマホではメニュー内に最初から表示しておく */
	.js .nav-list > li {
		opacity: 1;
		transform: none;
	}

	.prose {
		margin: 0;
	}

	.prose hr,
	.prose figure.wp-block-table {
		margin-inline: 0;
	}

	.prose td:first-child,
	.prose th:first-child {
		width: 5em;
		padding-right: 1em;
	}

	.panel-heading {
		font-size: 25px;
		line-height: 1.5;
	}
}

/* ==========================================================================
   視差効果を減らす設定
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition-duration: 0s !important;
		transition-delay: 0s !important;
	}

	.particles {
		display: none;
	}
}
