/* SVG波形区切りジェネレーター */

.dm-wave-tool {
	--dm-wave-editor-bg: var(--wp--preset--color--text);
	--dm-wave-editor-panel: color-mix(in srgb, var(--wp--preset--color--text) 91%, var(--wp--preset--color--white));
	--dm-wave-editor-line: color-mix(in srgb, var(--wp--preset--color--text-light) 55%, var(--wp--preset--color--text));
	--dm-wave-editor-text: var(--wp--preset--color--base);
	--dm-wave-editor-muted: color-mix(in srgb, var(--wp--preset--color--base) 68%, var(--wp--preset--color--text-light));
	--dm-wave-editor-focus: color-mix(in srgb, var(--wp--preset--color--primary) 55%, var(--wp--preset--color--white));
}

.dm-wave-intro {
	display: flex;
	min-height: 146px;
	margin-bottom: 24px;
	padding: clamp(26px, 5vw, 44px);
	align-items: flex-end;
	justify-content: space-between;
	gap: 32px;
	background:
		radial-gradient(circle at 92% 18%, rgb(255 255 255 / 0.72) 0 54px, transparent 55px),
		var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 16px;
}

.dm-wave-intro h2,
.dm-wave-intro p {
	margin: 0;
}

.dm-wave-intro h2 {
	font-size: clamp(1.35rem, 3vw, 2rem);
	letter-spacing: 0.03em;
	line-height: 1.45;
}

.dm-wave-intro > div > p {
	max-width: 720px;
	margin-top: 14px;
	color: var(--wp--preset--color--text-light);
	line-height: 1.85;
}

.dm-wave-studio {
	padding: clamp(18px, 3vw, 28px);
	background: var(--dm-wave-editor-bg);
	border-radius: 18px;
	box-shadow: 0 20px 45px rgb(34 48 58 / 0.12);
	color: var(--dm-wave-editor-text);
}

.dm-wave-studio :where(button, input, select) {
	font: inherit;
}

.dm-wave-studio :where(button, input, select):focus-visible {
	outline-color: var(--dm-wave-editor-focus);
}

.dm-wave-toolbar,
.dm-wave-preview-settings,
.dm-wave-panel-title,
.dm-wave-controls__header,
.dm-wave-code__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
}

.dm-wave-toolbar {
	margin-bottom: 18px;
}

.dm-wave-presets {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.dm-wave-presets > span {
	margin-right: 4px;
	color: var(--dm-wave-editor-muted);
	font-size: 0.78rem;
	font-weight: 700;
}

.dm-wave-presets button,
.dm-wave-toolbar__reset,
.dm-wave-layers button,
.dm-wave-layer__actions button {
	min-height: 38px;
	padding: 7px 12px;
	background: transparent;
	border: 1px solid var(--dm-wave-editor-line);
	border-radius: 8px;
	color: var(--dm-wave-editor-muted);
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1.4;
	cursor: pointer;
}

.dm-wave-presets button:hover,
.dm-wave-presets button[aria-pressed="true"],
.dm-wave-toolbar__reset:hover,
.dm-wave-layers button:hover {
	background: rgb(255 255 255 / 0.08);
	border-color: var(--dm-wave-editor-focus);
	color: var(--dm-wave-editor-text);
}

.dm-wave-preview-settings {
	display: grid;
	grid-template-columns: minmax(190px, 0.75fr) minmax(260px, 1.4fr) minmax(180px, 0.7fr);
	margin-bottom: 18px;
	padding: 16px 18px;
	background: var(--dm-wave-editor-panel);
	border: 1px solid var(--dm-wave-editor-line);
	border-radius: 12px;
}

.dm-wave-color-field,
.dm-wave-select-field,
.dm-wave-range-field {
	display: grid;
	min-width: 0;
	gap: 8px;
	color: var(--dm-wave-editor-muted);
	font-size: 0.8rem;
	font-weight: 700;
}

.dm-wave-color-field__inputs {
	display: grid;
	grid-template-columns: 42px minmax(0, 108px);
	gap: 8px;
}

.dm-wave-color-field input[type="color"] {
	width: 42px;
	height: 42px;
	padding: 3px;
	background: transparent;
	border: 1px solid var(--dm-wave-editor-line);
	border-radius: 8px;
	cursor: pointer;
}

.dm-wave-color-field input[type="text"],
.dm-wave-select-field select {
	width: 100%;
	min-height: 42px;
	padding: 8px 10px;
	background: var(--dm-wave-editor-bg);
	border: 1px solid var(--dm-wave-editor-line);
	border-radius: 8px;
	color: var(--dm-wave-editor-text);
	font-family: var(--wp--preset--font-family--en);
	font-size: 0.84rem;
}

.dm-wave-range-field > span {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.dm-wave-range-field b {
	color: var(--dm-wave-editor-text);
	font-weight: 700;
}

.dm-wave-range-field output {
	color: var(--dm-wave-editor-focus);
	font-family: var(--wp--preset--font-family--en);
	font-size: 0.78rem;
}

.dm-wave-range-field input[type="range"] {
	width: 100%;
	margin: 0;
	accent-color: var(--dm-wave-editor-focus);
	cursor: ew-resize;
}

.dm-wave-preview {
	position: relative;
	border: 1px solid var(--dm-wave-editor-line);
	border-radius: 13px;
	overflow: hidden;
	background: var(--wp--preset--color--white);
}

.dm-wave-preview__section {
	display: flex;
	padding-inline: clamp(18px, 4vw, 42px);
	color: rgb(34 48 58 / 0.58);
}

.dm-wave-preview__section span {
	padding: 5px 9px;
	background: rgb(255 255 255 / 0.68);
	border-radius: 999px;
	font-size: 0.67rem;
	font-weight: 700;
	line-height: 1.3;
}

.dm-wave-preview__section--before {
	min-height: 108px;
	padding-top: 22px;
	align-items: flex-start;
	background: var(--wp--preset--color--white);
}

.dm-wave-preview__canvas {
	position: relative;
	height: 180px;
	margin-top: -1px;
	background: var(--wp--preset--color--white);
	touch-action: none;
}

.dm-wave-preview__canvas svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.dm-wave-preview__section--after {
	min-height: 132px;
	padding-top: 22px;
	align-items: flex-start;
	justify-content: space-between;
	background: var(--wp--preset--color--surface);
}

.dm-wave-preview__section--after strong {
	align-self: center;
	margin-inline: auto;
	color: rgb(34 48 58 / 0.65);
	font-size: clamp(0.95rem, 2vw, 1.25rem);
	letter-spacing: 0.06em;
}

.dm-wave-path {
	cursor: pointer;
}

.dm-wave-path[data-selected="true"] {
	filter: drop-shadow(0 -1px 0 rgb(255 255 255 / 0.7));
}

.dm-wave-handles line {
	stroke: rgb(6 147 205 / 0.72);
	stroke-width: 2;
	stroke-dasharray: 8 7;
	vector-effect: non-scaling-stroke;
}

.dm-wave-handle {
	stroke: var(--dm-wave-editor-text);
	stroke-width: 2;
	vector-effect: non-scaling-stroke;
	cursor: grab;
}

.dm-wave-handle:active {
	cursor: grabbing;
}

.dm-wave-handle--edge {
	fill: var(--wp--preset--color--primary);
}

.dm-wave-handle--control {
	fill: var(--wp--preset--color--accent);
}

.dm-wave-drag-hint {
	margin: 10px 2px 0;
	color: var(--dm-wave-editor-muted);
	font-size: 0.76rem;
}

.dm-wave-drag-hint span {
	color: var(--dm-wave-editor-focus);
}

.dm-wave-editor {
	display: grid;
	grid-template-columns: minmax(250px, 0.7fr) minmax(0, 1.6fr);
	gap: 18px;
	margin-top: 22px;
}

.dm-wave-layers,
.dm-wave-controls {
	min-width: 0;
	padding: 18px;
	background: var(--dm-wave-editor-panel);
	border: 1px solid var(--dm-wave-editor-line);
	border-radius: 12px;
}

.dm-wave-panel-title {
	align-items: flex-start;
	margin-bottom: 14px;
}

.dm-wave-panel-title h3,
.dm-wave-panel-title p,
.dm-wave-controls__header h3,
.dm-wave-controls__header span {
	margin: 0;
}

.dm-wave-panel-title h3,
.dm-wave-controls__header h3 {
	font-size: 1rem;
	line-height: 1.4;
}

.dm-wave-panel-title p,
.dm-wave-controls__header > div > span {
	margin-top: 4px;
	color: var(--dm-wave-editor-muted);
	font-size: 0.72rem;
	line-height: 1.5;
}

.dm-wave-panel-title > button {
	flex: 0 0 auto;
	border-color: var(--dm-wave-editor-focus);
	color: var(--dm-wave-editor-focus);
}

.dm-wave-panel-title > button:disabled {
	border-color: var(--dm-wave-editor-line);
	cursor: not-allowed;
	opacity: 0.45;
}

.dm-wave-layer-list {
	display: grid;
	gap: 8px;
}

.dm-wave-layer {
	display: grid;
	grid-template-columns: 1fr;
	align-items: center;
	gap: 2px;
	padding: 8px;
	background: var(--dm-wave-editor-bg);
	border: 1px solid transparent;
	border-radius: 9px;
}

.dm-wave-layer[data-selected="true"] {
	border-color: var(--dm-wave-editor-focus);
}

.dm-wave-layer__select {
	display: flex;
	min-width: 0;
	min-height: 40px;
	padding: 7px 8px;
	align-items: center;
	gap: 10px;
	background: transparent;
	border: 0;
	color: var(--dm-wave-editor-text);
	font-size: 0.82rem;
	font-weight: 700;
	cursor: pointer;
	text-align: left;
}

.dm-wave-layer__swatch {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
	border: 2px solid rgb(255 255 255 / 0.45);
	border-radius: 50%;
}

.dm-wave-layer__select span:last-child {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dm-wave-layer__actions {
	display: flex;
	gap: 4px;
	justify-content: flex-end;
}

.dm-wave-layer__actions button {
	display: grid;
	width: 34px;
	min-height: 34px;
	padding: 0;
	place-items: center;
	border-color: transparent;
	font-family: var(--wp--preset--font-family--en);
	font-size: 0.9rem;
}

.dm-wave-layer__actions button:disabled {
	cursor: not-allowed;
	opacity: 0.28;
}

.dm-wave-controls__header {
	align-items: flex-start;
	margin-bottom: 20px;
}

.dm-wave-color-field--layer {
	flex: 0 0 auto;
}

.dm-wave-control-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px 24px;
}

.dm-wave-range-field--opacity {
	grid-column: 1 / -1;
}

.dm-wave-code {
	margin-top: 24px;
	padding: clamp(24px, 5vw, 42px);
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 16px;
}

.dm-wave-code__header {
	margin-bottom: 22px;
}

.dm-wave-code__header h2,
.dm-wave-code__header p {
	margin: 0;
}

.dm-wave-code__header h2 {
	font-size: clamp(1.3rem, 3vw, 1.7rem);
	line-height: 1.4;
}

.dm-wave-code__header p {
	margin-top: 7px;
	color: var(--wp--preset--color--text-light);
	font-size: 0.88rem;
}

.dm-wave-code__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
}

.dm-wave-code-field {
	display: grid;
	min-width: 0;
	gap: 10px;
	font-size: 0.88rem;
	font-weight: 700;
}

.dm-wave-code-field textarea {
	width: 100%;
	min-height: 270px;
	padding: 15px;
	resize: vertical;
	background: var(--wp--preset--color--text);
	border: 1px solid var(--wp--preset--color--text);
	border-radius: 10px;
	color: var(--wp--preset--color--base);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.76rem;
	font-weight: 400;
	line-height: 1.65;
	tab-size: 2;
}

.dm-wave-code-field .btn-primary {
	justify-self: start;
}

.dm-wave-code .dm-tool-status {
	margin-top: 14px;
	text-align: center;
}

@media (max-width: 860px) {
	.dm-wave-intro {
		align-items: flex-start;
		flex-direction: column;
	}

	.dm-wave-preview-settings {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.dm-wave-range-field--height {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.dm-wave-editor,
	.dm-wave-code__grid {
		grid-template-columns: 1fr;
	}

	.dm-wave-layers {
		order: 1;
	}

	.dm-wave-controls {
		order: 2;
	}
}

@media (max-width: 580px) {
	.dm-wave-studio {
		margin-inline: -12px;
		border-radius: 12px;
	}

	.dm-wave-toolbar,
	.dm-wave-code__header {
		align-items: stretch;
		flex-direction: column;
	}

	.dm-wave-presets {
		display: grid;
		grid-template-columns: 1fr;
	}

	.dm-wave-presets > span {
		margin-bottom: 2px;
	}

	.dm-wave-preview-settings,
	.dm-wave-control-grid {
		grid-template-columns: 1fr;
	}

	.dm-wave-range-field--height,
	.dm-wave-range-field--opacity {
		grid-column: auto;
		grid-row: auto;
	}

	.dm-wave-preview__section--before {
		min-height: 76px;
	}

	.dm-wave-preview__section--after {
		min-height: 110px;
	}

	.dm-wave-preview__section--after strong {
		display: none;
	}

	.dm-wave-panel-title,
	.dm-wave-controls__header {
		align-items: stretch;
		flex-direction: column;
	}

	.dm-wave-panel-title > button {
		width: 100%;
	}

	.dm-wave-color-field__inputs {
		grid-template-columns: 42px minmax(0, 1fr);
	}

	.dm-wave-code__header .btn-secondary,
	.dm-wave-code-field .btn-primary {
		width: 100%;
		text-align: center;
	}

	.dm-wave-code-field textarea {
		min-height: 220px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dm-wave-tool * {
		scroll-behavior: auto;
	}
}
