/**
 * 卒業カウントダウンカレンダー作成（[picolabo_sotsugyo]）。共通部品は base.css。
 *
 * 左（スマホでは上）に設定、右にプレビュー。ページ（.sc-page）は mm 単位で A4 の大きさにして、
 * プレビューでは JS が枠の幅に合わせて縮め、印刷ではそのままの大きさで1枚ずつ出す。
 * 印刷するページは body 直下に移すので、.sc-page の指定は .sc の外でも効くように書く。
 */

@media (min-width: 1000px) {
	.sc .sc-layout {
		grid-template-columns: 400px minmax(0, 1fr);
	}

	.sc-preview {
		position: sticky;
		top: calc(var(--header-h) + 16px);
	}
}

/* 設定
   -------------------------------------------------------------------------- */
.sc-setup {
	display: grid;
	gap: 18px;
}

.sc .sc-setup__sub {
	margin-top: 10px;
	padding-top: 18px;
	border-top: 1px solid var(--c-line);
}

.sc .sc-field {
	display: grid;
	gap: 8px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.sc-field legend {
	margin-bottom: 8px;
	padding: 0;
}

.sc-count,
.sc-range {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.sc .sc-count .pt-input {
	width: 96px;
	font-family: var(--font-en);
	font-size: 1.8rem;
	font-weight: 600;
	text-align: right;
}

.sc-count > span {
	font-weight: 700;
}

.sc-presets {
	display: flex;
	gap: 6px;
	margin-left: auto;
}

.sc .sc-preset {
	min-width: 48px;
	min-height: 34px;
	padding: 0 10px;
	border: 1px solid var(--c-line-2);
	border-radius: 999px;
	background: #fff;
	color: var(--c-ink-2);
	font: 600 1.3rem/1 var(--font-en);
	cursor: pointer;
}

.sc .sc-preset:hover {
	border-color: var(--c-ink);
	color: var(--c-ink);
}

.sc .sc-range .pt-input {
	flex: 1;
	min-width: 130px;
}

.sc-radio {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid var(--c-line-2);
	border-radius: var(--radius-s);
	font-size: 1.4rem;
	cursor: pointer;
}

.sc-radio:has(input:checked) {
	border-color: var(--c-ink);
	background: var(--c-tint);
	font-weight: 700;
}

.sc-radio input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--c-ink);
}

.sc-seg {
	display: flex;
	gap: 8px;
}

.sc-radio--inline {
	flex: 1;
}

.sc .sc-field .pt-check + .pt-check {
	margin-top: 2px;
}

.sc-designs {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.sc-design {
	display: grid;
	justify-items: center;
	gap: 6px;
	padding: 10px 6px;
	border: 1px solid var(--c-line-2);
	border-radius: var(--radius-s);
	font-size: 1.3rem;
	cursor: pointer;
}

.sc-design:has(input:checked) {
	border-color: var(--c-ink);
	background: var(--c-tint);
	font-weight: 700;
}

.sc-design input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.sc-design:has(input:focus-visible) {
	outline: 2px solid var(--c-blue);
	outline-offset: 1px;
}

/* デザインの見本（小さなページ） */
.sc-design__swatch {
	position: relative;
	width: 44px;
	height: 60px;
	border-radius: 4px;
	background: #fff;
	box-shadow: 0 0 0 1px var(--c-line-2);
}

.sc-design__swatch::after {
	content: "15";
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font: 600 2rem/1 var(--font-en);
}

.sc-design--simple .sc-design__swatch {
	box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4.5px var(--c-ink), 0 0 0 1px var(--c-line-2);
}

.sc-design--sakura .sc-design__swatch {
	background: radial-gradient(circle at 18% 14%, #f7b3cc 0 5px, transparent 6px), radial-gradient(circle at 82% 88%, #f7b3cc 0 5px, transparent 6px), #fff;
	color: #d6457a;
}

.sc-design--pop .sc-design__swatch {
	background: linear-gradient(90deg, #ff6b7a 0 20%, #ffc83d 20% 40%, #4cc3ff 40% 60%, #7ed321 60% 80%, #9b6bff 80%) top / 100% 7px no-repeat, #fff;
	color: #2f86d6;
}

/* プレビュー
   -------------------------------------------------------------------------- */
.sc-preview {
	display: grid;
	gap: 14px;
}

.sc-preview__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 12px;
}

.sc .sc-preview__summary {
	color: var(--c-ink-2);
	font-size: 1.3rem;
	font-weight: 700;
}

.sc-stage {
	position: relative;
	overflow: hidden;
	border-radius: 4px;
	box-shadow: 0 0 0 1px var(--c-line-2), 0 6px 20px rgba(30, 35, 40, 0.12);
}

.sc-stage__inner {
	width: max-content;
	transform-origin: top left;
}

.sc-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.pt .sc-pager .pt-btn {
	min-width: 44px;
	padding: 0 12px;
}

.sc .sc-pager__now {
	min-width: 80px;
	font-family: var(--font-en);
	font-size: 1.5rem;
	font-weight: 600;
	text-align: center;
}

.pt .sc-print-btn {
	min-height: 52px;
	font-size: 1.6rem;
	font-weight: 700;
}

/* ページ（A4）
   -------------------------------------------------------------------------- */
.sc-page {
	position: relative;
	box-sizing: border-box;
	display: flex;
	width: 210mm;
	height: 296.5mm; /* ちょうど 297mm だと、印刷で白いページが1枚増えることがある */
	padding: 18mm 18mm 14mm;
	overflow: hidden;
	background: #fff;
	color: #1e2328;
	font-family: var(--font-ja);
	-webkit-print-color-adjust: exact;
	print-color-adjust: exact;
}

.sc-page--landscape {
	width: 297mm;
	height: 209.5mm;
	padding: 14mm 22mm 12mm;
}

.sc-page p {
	margin: 0;
}

.sc-page__body {
	position: relative;
	z-index: 1;
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	text-align: center;
}

.sc-page__date {
	color: #4a535c;
	font-size: 9mm;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.sc-page__label {
	margin-top: 8mm;
	font-size: 15mm;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: 0.06em;
}

.sc-page__count {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 3mm;
	margin-top: 4mm;
	line-height: 0.9;
}

.sc-page__count span {
	font-size: 16mm;
	font-weight: 800;
}

.sc-page__count b {
	font-family: var(--font-en);
	font-size: 96mm;
	font-weight: 600;
	letter-spacing: -0.03em;
}

.sc-page__count--3 b {
	font-size: 72mm;
}

/* 卒業式の日のページ：メッセージ欄の上の空いたところの真ん中に、大きく出す。 */
.sc-page__last {
	display: grid;
	flex: 1;
	place-items: center;
	width: 100%;
	font-size: 19mm;
	font-weight: 800;
	line-height: 1.35;
	text-wrap: balance;
	word-break: keep-all;
	overflow-wrap: anywhere;
}

.sc-page__last + .sc-page__memo {
	margin-top: 0;
}

.sc-page__memo {
	width: 100%;
	margin-top: auto;
	text-align: left;
}

.sc-page__memo-label {
	color: #66717b;
	font-size: 5mm;
	font-weight: 700;
}

.sc-page__memo i {
	display: block;
	height: 13mm;
	border-bottom: 0.4mm dashed #b5bfc8;
}

.sc-page__sign {
	display: flex;
	align-items: flex-end;
	gap: 3mm;
	align-self: flex-end;
	margin-top: 7mm;
	font-size: 6mm;
	font-weight: 700;
}

.sc-page__sign span {
	width: 55mm;
	height: 8mm;
	border-bottom: 0.4mm solid #1e2328;
}

.sc-page__school {
	margin-top: 5mm;
	color: #4a535c;
	font-size: 5.5mm;
	font-weight: 700;
}

/* 横向き：数字を少し小さく、メッセージ欄は2行にする。 */
.sc-page--landscape .sc-page__label {
	margin-top: 4mm;
	font-size: 12mm;
}

.sc-page--landscape .sc-page__count b {
	font-size: 78mm;
}

.sc-page--landscape .sc-page__count--3 b {
	font-size: 64mm;
}

.sc-page--landscape .sc-page__memo i:nth-of-type(n + 3) {
	display: none;
}

/* シンプル：黒い細い枠。 */
.sc-page--simple::before {
	content: "";
	position: absolute;
	inset: 8mm;
	border: 0.8mm solid #1e2328;
	border-radius: 4mm;
}

/* さくら：桃色の枠と、角の桜。 */
.sc-page--sakura::before {
	content: "";
	position: absolute;
	inset: 8mm;
	border: 0.8mm solid #f2a7c3;
	border-radius: 6mm;
}

.sc-page--sakura .sc-page__label {
	color: #b8336a;
}

.sc-page--sakura :is(.sc-page__count b, .sc-page__last) {
	color: #d6457a;
}

.sc-page__corner {
	position: absolute;
	width: 52mm;
	height: 52mm;
}

.sc-page__corner--tl {
	top: 2mm;
	left: 2mm;
}

.sc-page__corner--br {
	right: 2mm;
	bottom: 2mm;
}

.sc-page__corner--bl {
	bottom: 2mm;
	left: 2mm;
}

/* カラフル：上に旗、下の角に紙ふぶき。 */
.sc-page__bunting {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 20mm;
}

.sc-page--pop .sc-page__label {
	color: #ff5468;
}

.sc-page--pop :is(.sc-page__count b, .sc-page__last) {
	color: #2f86d6;
}

/* 印刷：作ったページの箱だけを出す
   -------------------------------------------------------------------------- */
@media print {
	html.sc-printing body > :not(.sc-print) {
		display: none !important;
	}

	html.sc-printing .sc-print {
		display: block !important;
	}

	.sc-print .sc-page {
		break-after: page;
	}

	.sc-print .sc-page:last-child {
		break-after: auto;
	}
}
