/**
 * toybox — theme.json で表せない あしらい だけを書く。
 * 色・余白・文字サイズは theme.json のプリセット（--wp--preset--*）を使う。
 */

:root {
	--toybox-ink: var(--wp--preset--color--ink);
	--toybox-border: var(--wp--custom--border);
	--toybox-ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
	--toybox-wave-fill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 16'%3E%3Cpath d='M0 16V8Q20 0 40 8T80 8V16Z'/%3E%3C/svg%3E");
	--toybox-wave-line: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 16'%3E%3Cpath d='M0 8Q20 0 40 8T80 8' fill='none' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E");
}

/* ---------- 全体 ---------- */

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-x: clip;
}

/*
 * コピーは分かち書き（スペース区切り）なので、スペースの位置だけで改行する。
 * コアの .wp-block-column などが word-break: break-word を継承させるので、文字要素に直接指定する。
 */
:where(.wp-site-blocks, .editor-styles-wrapper) :is(p, h1, h2, h3, h4, h5, h6, li, dt, dd, figcaption),
.wp-block-button .wp-block-button__link {
	word-break: keep-all;
	overflow-wrap: anywhere;
}

/* ヘッダー・本文・フッターのあいだに隙間を作らない（セクションの色を つなげる） */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

::selection {
	background: var(--wp--preset--color--lemon);
	color: var(--toybox-ink);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 3px dashed var(--toybox-ink);
	outline-offset: 3px;
	border-radius: 6px;
}

.has-fredoka-font-family,
.toybox-eyebrow {
	letter-spacing: 0.06em;
}

/* 小さな英字の見出しラベル（例：TOYS） */
.toybox-eyebrow {
	font-family: var(--wp--preset--font-family--fredoka);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.18em;
	color: var(--wp--preset--color--ink-soft);
}

/* ---------- ボタン：おもちゃっぽく押しこめる ---------- */

.wp-element-button,
.wp-block-button__link {
	transition:
		transform 0.18s var(--toybox-ease-pop),
		box-shadow 0.18s var(--toybox-ease-pop),
		background-color 0.2s;
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	transform: translate(-1px, -2px);
	box-shadow: 5px 6px 0 var(--toybox-ink);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translate(3px, 3px);
	box-shadow: 1px 1px 0 var(--toybox-ink);
}

/* ---------- ヘッダー ---------- */

.toybox-header {
	position: relative;
	z-index: 10;
}

.toybox-logo {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.toybox-logo img {
	width: 44px;
	height: auto;
	transition: transform 0.3s var(--toybox-ease-pop);
}

.toybox-logo:hover img {
	transform: rotate(-10deg) scale(1.08);
}

.toybox-header .wp-block-navigation-item__content {
	padding: 0.3em 0.8em;
	border-radius: var(--wp--custom--radius--pill);
	transition: background-color 0.2s;
}

.toybox-header .wp-block-navigation-item__content:hover,
.toybox-header .current-menu-item > .wp-block-navigation-item__content {
	background: var(--wp--preset--color--white);
	box-shadow: inset 0 0 0 2px var(--toybox-ink);
}

.toybox-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--base);
	padding: var(--wp--preset--spacing--50);
}

.toybox-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--large);
}

/* ---------- ブロックスタイル：おもちゃカード ---------- */

.wp-block-group.is-style-toy-card {
	position: relative;
	border: var(--toybox-border);
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--wp--preset--shadow--toy-lg);
	transition:
		transform 0.3s var(--toybox-ease-pop),
		box-shadow 0.3s var(--toybox-ease-pop);
}

.wp-block-group.is-style-toy-card:has(a:hover),
.wp-block-group.is-style-toy-card:has(a:focus-visible) {
	transform: translate(-2px, -6px) rotate(-1.2deg);
	box-shadow: 8px 12px 0 var(--toybox-ink);
}

.wp-block-group.is-style-toy-card:nth-child(even):has(a:hover),
.wp-block-group.is-style-toy-card:nth-child(even):has(a:focus-visible) {
	transform: translate(-2px, -6px) rotate(1.2deg);
}

/* おもちゃだな：最後の段も中央にそろえる */
.toybox-shelf > .wp-block-group.is-style-toy-card {
	flex: 0 1 21rem;
}

/* カード全体をリンクにする（見出しのリンクを広げる） */
.wp-block-group.is-style-toy-card :where(h2, h3) a {
	text-decoration: none;
}

.wp-block-group.is-style-toy-card :where(h2, h3) a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.wp-block-group.is-style-toy-card :where(h2, h3) a:focus-visible {
	outline: none;
}

.wp-block-group.is-style-toy-card:has(:where(h2, h3) a:focus-visible) {
	outline: 3px dashed var(--toybox-ink);
	outline-offset: 6px;
}

.wp-block-group.is-style-toy-card .wp-block-image img {
	transition: transform 0.4s var(--toybox-ease-pop);
}

.wp-block-group.is-style-toy-card:has(a:hover) .wp-block-image img {
	transform: scale(1.08) rotate(-4deg);
}

.toybox-card__more {
	font-family: var(--wp--preset--font-family--fredoka);
	font-weight: 600;
	letter-spacing: 0.08em;
}

/* ---------- ブロックスタイル：ふきだし ---------- */

.wp-block-group.is-style-bubble {
	position: relative;
	border: var(--toybox-border);
	border-radius: var(--wp--custom--radius--lg);
	background-color: var(--wp--preset--color--white);
}

.wp-block-group.is-style-bubble::before {
	content: "";
	position: absolute;
	left: -11px;
	top: 50%;
	width: 20px;
	height: 20px;
	background: inherit;
	border-left: var(--toybox-border);
	border-bottom: var(--toybox-border);
	border-bottom-left-radius: 4px;
	transform: translateY(-50%) rotate(45deg);
}

@media (max-width: 781px) {
	.wp-block-group.is-style-bubble::before {
		left: 50%;
		top: -11px;
		transform: translateX(-50%) rotate(135deg);
	}
}

/* ---------- ブロックスタイル：なみなみ ---------- */

.wp-block-group.is-style-wave-top {
	position: relative;
}

.wp-block-group.is-style-wave-top::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 16px;
	margin-bottom: -1px;
	background: inherit;
	-webkit-mask: var(--toybox-wave-fill) repeat-x left bottom / 80px 16px;
	mask: var(--toybox-wave-fill) repeat-x left bottom / 80px 16px;
}

hr.wp-block-separator.is-style-wave {
	border: 0;
	height: 16px;
	width: min(100%, 12rem);
	background-color: currentColor;
	opacity: 1;
	-webkit-mask: var(--toybox-wave-line) repeat-x center / 40px 8px;
	mask: var(--toybox-wave-line) repeat-x center / 40px 8px;
}

/* ---------- ブロックスタイル：ゆらゆら ---------- */

.wp-block-image.is-style-bob img {
	animation: toybox-bob 3.6s ease-in-out infinite;
}

@keyframes toybox-bob {
	50% {
		transform: translateY(-8px) rotate(-2deg);
	}
}

/* ---------- トップ：ヒーロー ---------- */

.toybox-hero__title {
	text-wrap: balance;
}

.toybox-hero__title .toybox-hero__accent {
	background: linear-gradient(transparent 62%, var(--wp--preset--color--lemon) 62%, var(--wp--preset--color--lemon) 92%, transparent 92%);
	padding: 0 0.1em;
}

/* ---------- 背景に浮かぶ おもちゃ ---------- */

.wp-site-blocks {
	position: relative;
	z-index: 1;
}

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

.toybox-floaties__item {
	position: absolute;
	width: var(--size, 48px);
	height: auto;
	opacity: 0.35;
	animation: toybox-float var(--dur, 14s) ease-in-out infinite;
	animation-delay: var(--delay, 0s);
}

.toybox-floaties__item--1 { top: 22%; left: 1.5%; --size: 36px; --dur: 13s; }
.toybox-floaties__item--2 { top: 6%; right: 2%; --size: 88px; --dur: 18s; --delay: -4s; }
.toybox-floaties__item--3 { top: 48%; left: 1%; --size: 50px; --dur: 15s; --delay: -7s; }
.toybox-floaties__item--4 { top: 68%; right: 1.5%; --size: 36px; --dur: 12s; --delay: -2s; }
.toybox-floaties__item--5 { top: 84%; left: 1.5%; --size: 44px; --dur: 16s; --delay: -9s; }
.toybox-floaties__item--6 { top: 34%; right: 1%; --size: 28px; --dur: 10s; --delay: -5s; }
.toybox-floaties__item--7 { top: 62%; left: 0.5%; --size: 72px; --dur: 20s; --delay: -11s; opacity: 0.22; }
.toybox-floaties__item--8 { top: 90%; right: 3%; --size: 30px; --dur: 11s; --delay: -3s; }

/* 余白の少ない画面では、文字に かぶらないよう 数を減らす */
@media (max-width: 1279px) {
	.toybox-floaties__item:not(.toybox-floaties__item--2, .toybox-floaties__item--4, .toybox-floaties__item--8) {
		display: none;
	}
}

@keyframes toybox-float {
	0%,
	100% {
		transform: translate(0, 0) rotate(0deg);
	}
	33% {
		transform: translate(10px, -18px) rotate(8deg);
	}
	66% {
		transform: translate(-8px, -6px) rotate(-6deg);
	}
}

/* ---------- 動きを減らす設定のとき ---------- */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
