/**
 * The advent calendar (`mf/advent-calendar`), layout `grid` — catalogue 01, "Klassisches
 * Gitter" (divb-hq/design/adventskalender.html). With images off and the doors 1–24 it is
 * catalogue 04, the number wall: a switch, not a layout (SPEC K5).
 *
 * Rules target `.mf-adv`, the calendar, never the block wrapper: in the editor the
 * server's wrapper sits inside the editor's own `.wp-block-mf-advent-calendar`.
 *
 * Without the script every door is open: the faces carry `hidden`, the articles show.
 * Under `.mf-adv-js` the state classes the script sets decide — and they are set while the
 * parser inserts each door, before the first paint (assets/advent-calendar/advent-calendar.js).
 *
 * The festive part is the structure and the motion, not a palette (the card). Type comes
 * from the theme; colours are the blog's: ink, grey, hairline, and the orange that carries
 * small text on white at 5.67:1.
 */

.mf-adv {
	--mf-adv-ink: #111;
	--mf-adv-gray: #636363;
	--mf-adv-hair: #e5e5e5;
	--mf-adv-wash: #f6f6f6;
	--mf-adv-orange: #e35205;
	--mf-adv-orange-text: #b4410a;
	--mf-adv-radius: 4px;
	--mf-adv-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

	container-type: inline-size;
	color: var(--mf-adv-ink);
}

/* ---------- heading ---------- */

.mf-adv__head {
	margin: 0 0 16px;
}

.mf-adv__kicker {
	margin: 0 0 4px;
	color: var(--mf-adv-orange-text);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.mf-adv .mf-adv__heading {
	margin: 0 0 4px;
	color: var(--mf-adv-ink);
	font-size: 1.5rem;
	line-height: 1.2;
	letter-spacing: -0.015em;
}

.mf-adv__intro {
	margin: 0;
	color: var(--mf-adv-gray);
	font-size: 0.9rem;
}

/* ---------- the grid: 8 / 6 / 4 / 3 columns ---------- */

.mf-adv__doors {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@container (min-width: 1000px) {

	.mf-adv__doors {
		grid-template-columns: repeat(8, minmax(0, 1fr));
	}
}

@container (max-width: 900px) {

	.mf-adv__doors {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@container (max-width: 480px) {

	.mf-adv__doors {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 6px;
	}
}

.mf-adv__door {
	position: relative;
	min-height: 150px;
	margin: 0;
	overflow: hidden;
	border: 1px solid var(--mf-adv-hair);
	border-radius: var(--mf-adv-radius);
	background: #fff;
}

/* ---------- the closed face: a real button ---------- */

.mf-adv__face {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	min-height: 150px;
	margin: 0;
	padding: 10px 12px;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: start;
	cursor: pointer;
	appearance: none;
}

.mf-adv__face[hidden] {
	display: none;
}

/* Before the script has removed `hidden` from a face it already decided to show. */
.mf-adv-js .mf-adv__door.is-closed > .mf-adv__face,
.mf-adv-js .mf-adv__door.is-today > .mf-adv__face {
	display: flex;
}

.mf-adv-js .mf-adv__door.is-closed > .mf-adv__content,
.mf-adv-js .mf-adv__door.is-today > .mf-adv__content {
	display: none;
}

.mf-adv__face[aria-disabled="true"] {
	cursor: not-allowed;
}

.mf-adv__face:focus {
	outline: none;
}

.mf-adv__face:focus-visible {
	outline: 2px solid var(--mf-adv-orange);
	outline-offset: -2px;
}

.mf-adv__num {
	font-size: 38px;
	font-weight: 300;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	letter-spacing: -0.03em;
}

.mf-adv__when {
	color: var(--mf-adv-gray);
	font-size: 12px;
}

.mf-adv__door.is-today {
	border-color: var(--mf-adv-orange);
	box-shadow: inset 0 0 0 1px var(--mf-adv-orange);
}

.mf-adv__door.is-today .mf-adv__num {
	font-weight: 700;
}

.mf-adv__door.is-today .mf-adv__when {
	color: var(--mf-adv-orange-text);
	font-weight: 600;
}

/* ---------- behind the door ---------- */

.mf-adv__content {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.mf-adv__content:focus {
	outline: none;
}

.mf-adv__content:focus-visible {
	outline: 2px solid var(--mf-adv-orange);
	outline-offset: -2px;
}

/* Scaled, never cropped: the banners carry their title in the picture (K15). */
.mf-adv .mf-adv__image {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	margin: 0;
	background: var(--mf-adv-wash);
}

.mf-adv__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px 10px 10px;
}

.mf-adv__date {
	color: var(--mf-adv-gray);
	font-size: 11.5px;
	font-weight: 700;
}

.mf-adv .mf-adv__title {
	display: -webkit-box;
	overflow: hidden;
	color: inherit;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
	text-decoration: none;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
}

.mf-adv .mf-adv__title:hover,
.mf-adv .mf-adv__title:focus-visible {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.mf-adv__meta {
	color: var(--mf-adv-gray);
	font-size: 12px;
	line-height: 1.4;
}

.mf-adv .mf-adv__note,
.mf-adv .mf-adv__empty {
	margin: 0;
	color: var(--mf-adv-gray);
	font-size: 12px;
	line-height: 1.4;
}

.mf-adv .mf-adv__note {
	color: var(--mf-adv-ink);
	font-style: italic;
}

/* ---------- the opening: it comes in; reduced motion cross-fades (K14) ---------- */

.mf-adv__door.is-opening > .mf-adv__content {
	animation: mf-adv-open 0.55s var(--mf-adv-ease) both;
}

@keyframes mf-adv-open {

	from {
		opacity: 0;
		transform: scale(0.96);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes mf-adv-fade {

	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {

	.mf-adv__door.is-opening > .mf-adv__content {
		animation: mf-adv-fade 0.2s ease both;
	}
}

/* ---------- the live region ---------- */

.mf-adv .mf-adv__status {
	min-height: 1.5em;
	margin: 10px 0 0;
	color: var(--mf-adv-orange-text);
	font-size: 14px;
	font-weight: 500;
}

/* ---------- images off: the number wall (catalogue 04) ---------- */

.mf-adv--no-images .mf-adv__num {
	font-size: 56px;
	font-weight: 200;
	letter-spacing: -0.05em;
	color: var(--mf-adv-gray);
}

.mf-adv--no-images .mf-adv__door.is-today .mf-adv__num {
	color: var(--mf-adv-orange);
	font-weight: 800;
}

.mf-adv--no-images .mf-adv__body {
	padding: 12px 14px 14px;
}

/* ---------- narrow: no image, smaller type (K15) ---------- */

@container (max-width: 480px) {

	.mf-adv .mf-adv__image,
	.mf-adv__meta {
		display: none;
	}

	.mf-adv .mf-adv__title {
		font-size: 12.5px;
	}

	.mf-adv__num {
		font-size: 30px;
	}

	.mf-adv--no-images .mf-adv__num {
		font-size: 42px;
	}

	.mf-adv__door,
	.mf-adv__face {
		min-height: 120px;
	}
}

/* ---------- the editor's notice for a year nobody has filled ---------- */

.mf-adv-notice {
	padding: 12px 16px;
	border: 1px dashed var(--mf-adv-hair, #e5e5e5);
	color: #636363;
}

/* ==========================================================================
   Layout `sheet` — catalogue 08, the tear-off calendar. One sheet at a time:
   the script marks the current door, the rest step aside. Without the script
   every sheet stands open, one under the other.
   ========================================================================== */

.mf-adv--sheet .mf-adv__doors,
.mf-adv--sheet .mf-adv__nav,
.mf-adv--sheet .mf-adv__overview {
	max-width: 420px;
}

.mf-adv--sheet .mf-adv__doors {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.mf-adv-js .mf-adv--sheet .mf-adv__door:not(.is-current) {
	display: none;
}

/* The pad: the sheets below show as a stack. Today keeps the stack and the hairline; the
   orange number is enough of a mark. The article fills the sheet, so its focus ring does. */
.mf-adv--sheet .mf-adv__door,
.mf-adv--sheet .mf-adv__door.is-today {
	display: flex;
	flex-direction: column;
	min-height: 330px;
	border-color: var(--mf-adv-hair);
	box-shadow:
		0 1px 0 #ddd,
		0 3px 0 -1px #fff,
		0 4px 0 -1px #ddd,
		0 7px 0 -2px #fff,
		0 8px 0 -2px #ddd;
}

.mf-adv--sheet .mf-adv__content {
	flex: 1 1 auto;
	height: auto;
	padding-top: 12px;
}

/* The binding strip at the top of the pad. */
.mf-adv--sheet .mf-adv__door::before {
	content: "";
	position: absolute;
	z-index: 3;
	top: 0;
	right: 0;
	left: 0;
	height: 12px;
	background: var(--mf-adv-ink);
}

.mf-adv--sheet .mf-adv__face,
.mf-adv--sheet .mf-adv__leave {
	position: absolute;
	z-index: 2;
	inset: 12px 0 0;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 0;
	border-top: 1px dashed #cfcfcf;
	background: #fff;
	text-align: center;
}

.mf-adv--sheet .mf-adv__leave {
	display: flex;
	flex-direction: column;
	padding: 10px 12px;
	transform-origin: 15% 0;
	animation: mf-adv-tear 0.9s cubic-bezier(0.5, 0, 0.75, 0) both;
	pointer-events: none;
}

.mf-adv__wd {
	color: var(--mf-adv-gray);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.mf-adv--sheet .mf-adv__num {
	color: var(--mf-adv-orange);
	font-size: 120px;
	font-weight: 800;
	line-height: 0.95;
	letter-spacing: -0.06em;
}

.mf-adv__mo {
	font-size: 15px;
	font-weight: 600;
}

.mf-adv--sheet .mf-adv__act {
	margin-top: 12px;
	padding: 8px 14px;
	border-radius: var(--mf-adv-radius);
	background: var(--mf-adv-ink);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
}

.mf-adv--sheet .mf-adv__door.is-closed .mf-adv__num {
	color: #767676;
	font-weight: 300;
}

.mf-adv--sheet .mf-adv__door.is-closed .mf-adv__act {
	background: none;
	color: var(--mf-adv-gray);
	font-weight: 500;
}

.mf-adv--sheet .mf-adv__body {
	gap: 8px;
	padding: 14px 20px 18px;
}

.mf-adv--sheet .mf-adv__date {
	color: var(--mf-adv-orange-text);
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.mf-adv--sheet .mf-adv__title {
	font-size: 20px;
	line-height: 1.2;
}

.mf-adv--sheet .mf-adv__meta,
.mf-adv--sheet .mf-adv__note {
	font-size: 14px;
}

/* Under the sheet everything is quiet: no frames, one line of controls, and the day
   row folded behind a link. 24 framed buttons there were too loud to stand unasked. */
.mf-adv__nav {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	margin-top: 14px;
	font-size: 14px;
}

.mf-adv__nav[hidden],
.mf-adv__overview[hidden] {
	display: none;
}

.mf-adv__position {
	color: var(--mf-adv-gray);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.mf-adv__step,
.mf-adv__days button {
	border: 0;
	background: transparent;
	color: var(--mf-adv-ink);
	font: inherit;
	cursor: pointer;
}

.mf-adv__step {
	justify-self: start;
	padding: 6px 10px;
	border-radius: 999px;
}

.mf-adv__step + .mf-adv__position + .mf-adv__step {
	justify-self: end;
}

.mf-adv__step:hover,
.mf-adv__days button:hover {
	background: rgb(0 0 0 / 6%);
}

.mf-adv__step[aria-disabled="true"],
.mf-adv__days button[aria-disabled="true"] {
	background: transparent;
	color: #9a9a9a;
	cursor: default;
}

.mf-adv__days button[aria-disabled="true"] {
	color: #b3b3b3;
}

.mf-adv__overview {
	margin-top: 6px;
	text-align: center;
}

.mf-adv__overview summary {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	padding: 4px 8px;
	color: var(--mf-adv-gray);
	font-size: 13px;
	list-style: none;
	cursor: pointer;
}

.mf-adv__overview summary::-webkit-details-marker {
	display: none;
}

.mf-adv__overview summary::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 1.5px solid currentcolor;
	border-bottom: 1.5px solid currentcolor;
	transform: rotate(45deg);
}

.mf-adv__overview[open] summary::after {
	margin-top: 3px;
	transform: rotate(-135deg);
}

.mf-adv__overview summary:hover {
	color: var(--mf-adv-ink);
}

/* The open days as a small month: three rows of eight, the days still to come pale. */
.mf-adv__days {
	display: grid;
	grid-template-columns: repeat(8, minmax(0, 1fr));
	gap: 4px;
	margin: 8px 0 0;
	padding: 12px;
	border-radius: var(--mf-adv-radius);
	background: #fff;
	box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
	list-style: none;
}

.mf-adv__days li {
	display: flex;
	justify-content: center;
	margin: 0;
}

.mf-adv__days button {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.mf-adv__days button[aria-current="true"],
.mf-adv__days button[aria-current="true"]:hover {
	background: var(--mf-adv-ink);
	color: #fff;
	font-weight: 600;
}

.mf-adv__step:focus-visible,
.mf-adv__days button:focus-visible,
.mf-adv__overview summary:focus-visible {
	outline: 2px solid var(--mf-adv-orange);
	outline-offset: 2px;
}

@keyframes mf-adv-tear {

	0% {
		transform: none;
	}

	20% {
		transform: rotate(-3deg);
	}

	100% {
		opacity: 0;
		transform: translateY(115%) rotate(14deg);
	}
}

@keyframes mf-adv-fade-out {

	from {
		opacity: 1;
	}

	to {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {

	.mf-adv--sheet .mf-adv__leave {
		animation: mf-adv-fade-out 0.2s ease both;
	}
}

/* ==========================================================================
   Layout `countdown` — catalogue 10: place 24 on 1 December, the year's
   number 1 on Christmas Eve. Open places are rows; the covered ones fold into
   one line the script writes.
   ========================================================================== */

.mf-adv--countdown .mf-adv__doors {
	display: block;
}

.mf-adv--countdown .mf-adv__door,
.mf-adv--countdown .mf-adv__later {
	min-height: 0;
	border: 0;
	border-bottom: 1px solid var(--mf-adv-hair);
	border-radius: 0;
	background: none;
}

.mf-adv-js .mf-adv--countdown .mf-adv__door.is-closed {
	display: none;
}

.mf-adv--countdown .mf-adv__face,
.mf-adv--countdown .mf-adv__content,
.mf-adv--countdown .mf-adv__later:not([hidden]) {
	display: grid;
	grid-template-columns: 110px minmax(0, 1fr);
	gap: 16px;
	align-items: center;
	min-height: 0;
	padding: 14px 0;
}

.mf-adv--countdown .mf-adv__face[hidden] {
	display: none;
}

.mf-adv-js .mf-adv--countdown .mf-adv__door.is-today > .mf-adv__face {
	display: grid;
}

.mf-adv--countdown .mf-adv__door.is-today {
	box-shadow: none;
}

.mf-adv__rank {
	font-size: 52px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	line-height: 0.9;
	letter-spacing: -0.05em;
	text-align: right;
}

.mf-adv__rank small {
	display: block;
	margin-bottom: 4px;
	color: var(--mf-adv-gray);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-align: right;
	text-transform: uppercase;
}

.mf-adv--countdown .mf-adv__door[data-day="24"] .mf-adv__rank {
	font-size: 68px;
}

.mf-adv--countdown .mf-adv__door.is-today .mf-adv__rank {
	color: var(--mf-adv-orange);
}

.mf-adv--countdown .mf-adv__act {
	justify-self: start;
	padding: 7px 12px;
	border-radius: var(--mf-adv-radius);
	background: var(--mf-adv-ink);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
}

.mf-adv--countdown .mf-adv__body {
	padding: 0;
}

.mf-adv--countdown .mf-adv__title {
	font-size: 17px;
}

.mf-adv__later .mf-adv__rank {
	color: #767676;
	font-size: 30px;
	font-weight: 300;
	letter-spacing: -0.02em;
}

.mf-adv__wait {
	color: var(--mf-adv-gray);
	font-size: 14.5px;
}

.mf-adv--countdown .mf-adv__door.is-opening > .mf-adv__content {
	animation: mf-adv-rise 0.7s var(--mf-adv-ease) both;
}

@keyframes mf-adv-rise {

	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {

	.mf-adv--countdown .mf-adv__door.is-opening > .mf-adv__content {
		animation: mf-adv-fade 0.2s ease both;
	}
}

@container (max-width: 480px) {

	.mf-adv--countdown .mf-adv__face,
	.mf-adv--countdown .mf-adv__content,
	.mf-adv--countdown .mf-adv__later:not([hidden]) {
		grid-template-columns: 64px minmax(0, 1fr);
		gap: 10px;
	}

	.mf-adv__rank {
		font-size: 36px;
	}

	.mf-adv--countdown .mf-adv__door[data-day="24"] .mf-adv__rank {
		font-size: 52px;
	}

	.mf-adv__later .mf-adv__rank {
		font-size: 20px;
	}

	.mf-adv--countdown .mf-adv__title {
		font-size: 15.5px;
	}

	.mf-adv--sheet .mf-adv__num {
		font-size: 96px;
	}
}

/* ==========================================================================
   The teaser under an article — catalogue 09.
   ========================================================================== */

.mf-adv-teaser {
	margin: 22px 0 10px;
	padding: 16px 18px 14px;
	border-top: 3px solid #e35205;
	background: #f6f6f6;
	color: #111;
}

.mf-adv-teaser .mf-adv-teaser__kicker {
	margin: 0 0 6px;
	color: #b4410a;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.mf-adv-teaser .mf-adv-teaser__text {
	margin: 0;
	font-size: 15px;
}

.mf-adv-teaser__strip {
	display: grid;
	grid-template-columns: repeat(24, minmax(0, 1fr));
	gap: 2px;
	margin: 12px 0 4px;
}

.mf-adv-teaser__strip span {
	height: 6px;
	background: #d9d9d9;
}

.mf-adv-teaser__strip .is-past {
	background: #111;
}

.mf-adv-teaser__strip .is-today {
	background: #e35205;
}

.mf-adv-teaser .mf-adv-teaser__count {
	margin: 0 0 10px;
	color: #636363;
	font-size: 12.5px;
}

.mf-adv-teaser .mf-adv-teaser__all {
	color: #1d4f99;
	font-size: 14px;
	font-weight: 600;
}
