/*
 * Noel Hub skin: Unfold 2027.
 *
 * Brand values live in skin.php and arrive here as --noel-* custom properties.
 * This file only uses those properties, so a new yearly look means a new
 * skin.php (plus this file if the design elements change).
 */

/* ---------- Semantic tokens ---------- */
:root {
	--noel-bg: var(--noel-paper);
	--noel-text: var(--noel-indigo);
	--noel-heading: var(--noel-indigo);
	--noel-surface: #fff;
	--noel-on-dark: var(--noel-paper);
	--noel-accent-on-dark: var(--noel-apricot);
	--noel-focus: var(--noel-dusk);
	--noel-rule: var(--noel-coral);
	--noel-line: color-mix(in srgb, var(--noel-indigo) 18%, transparent);

	--noel-radius: 14px;
	--noel-radius-pill: 999px;
	--noel-gutter: 16px;
}

/* ---------- Type ---------- */
.noel-hub {
	background: var(--noel-bg);
	color: var(--noel-text);
	font-family: var(--noel-font-body);
	font-size: 1rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

.noel-hub h1,
.noel-hub h2,
.noel-hub h3 {
	font-family: var(--noel-font-display);
	font-weight: 600;
	color: var(--noel-heading);
	line-height: 1.15;
	letter-spacing: 0;
	margin: 0;
	font-optical-sizing: auto;
}

/* One italic accent word per layout. Apricot only on dark grounds. */
.noel-accent {
	font-family: var(--noel-font-display);
	font-style: italic;
	font-weight: 500;
}

.noel-on-dark .noel-accent {
	color: var(--noel-accent-on-dark);
}

.noel-label {
	font-family: var(--noel-font-label);
	font-weight: 500;
	letter-spacing: 0;
}

/* Links on paper stay indigo and underlined: dusk is too light for small text there. */
:where(.noel-hub) a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

/* ---------- Focus ---------- */
.noel-hub :focus-visible {
	outline: 3px solid var(--noel-focus);
	outline-offset: 3px;
	border-radius: 4px;
}

.noel-on-dark :focus-visible {
	outline-color: var(--noel-apricot);
}

/* ---------- Pills and buttons (Poppins 500) ---------- */
.noel-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4em;
	min-height: 44px;
	padding: 0.55em 1.25em;
	border: 2px solid transparent;
	border-radius: var(--noel-radius-pill);
	font-family: var(--noel-font-label);
	font-weight: 500;
	font-size: 1rem;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	background: var(--noel-indigo);
	color: var(--noel-paper);
}

.noel-button:hover {
	background: color-mix(in srgb, var(--noel-indigo) 88%, #000);
}

/* On indigo: apricot pill with indigo text (6.3:1). */
.noel-on-dark .noel-button {
	background: var(--noel-apricot);
	color: var(--noel-indigo);
}

.noel-on-dark .noel-button:hover {
	background: color-mix(in srgb, var(--noel-apricot) 88%, #fff);
}

/* Outline pill, as in "Sundays" on the style guide. */
.noel-button--outline,
.noel-on-dark .noel-button--outline {
	background: transparent;
	border-color: currentColor;
	color: var(--noel-indigo);
}

.noel-on-dark .noel-button--outline {
	color: var(--noel-apricot);
}

.noel-button--outline:hover,
.noel-on-dark .noel-button--outline:hover {
	background: color-mix(in srgb, currentColor 12%, transparent);
}

/* Coral rule: one small mark per piece. */
.noel-rule {
	display: block;
	width: 56px;
	height: 4px;
	border: 0;
	margin: 0.75rem 0 0;
	background: var(--noel-rule);
}

/* ---------- The fold ----------
 * Three panels from cool to warm (indigo, dusk blue, apricot). Each crease
 * leans about 4 degrees off vertical, with a darker sliver and a fine light
 * line, as on the style guide's Design elements page.
 *
 * Markup:
 * <div class="noel-fold" aria-hidden="true">
 *   <span class="noel-fold__panel noel-fold__panel--mid"></span>
 *   <span class="noel-fold__panel noel-fold__panel--warm"></span>
 * </div>
 *
 * Variants: .noel-fold--band (header), .noel-fold--strip (card top edge),
 * .noel-fold--chip (small mark), .noel-fold--open (panels open on load).
 */
.noel-fold {
	--fold-mid-at: 46%;
	--fold-warm-at: 74%;
	--fold-sliver: 3%;
	position: relative;
	overflow: hidden;
	background: var(--noel-fold-cool);
	isolation: isolate;
}

.noel-fold__panel {
	position: absolute;
	top: -2px;
	bottom: -2px;
	right: -40%;
	transform: skewX(calc(var(--noel-crease-angle) * -1));
	transform-origin: 0 100%;
}

.noel-fold__panel--mid {
	left: var(--fold-mid-at);
	background: linear-gradient(
		to right,
		color-mix(in srgb, var(--noel-fold-mid) 72%, var(--noel-fold-cool)) 0 var(--fold-sliver),
		var(--noel-fold-mid) var(--fold-sliver)
	);
	box-shadow: -1px 0 0 color-mix(in srgb, var(--noel-paper) 45%, transparent);
}

.noel-fold__panel--warm {
	left: var(--fold-warm-at);
	background: linear-gradient(
		to right,
		color-mix(in srgb, var(--noel-fold-warm) 84%, #000) 0 calc(var(--fold-sliver) * 1.4),
		var(--noel-fold-warm) calc(var(--fold-sliver) * 1.4)
	);
	box-shadow: -1px 0 0 color-mix(in srgb, var(--noel-paper) 45%, transparent);
}

/* Band across the hub header: text sits on the cool side. */
.noel-fold--band {
	--fold-mid-at: 74%;
	--fold-warm-at: 87%;
	--fold-sliver: 1.2%;
}

@media (min-width: 720px) {
	.noel-fold--band {
		--fold-mid-at: 70%;
		--fold-warm-at: 84%;
		--fold-sliver: 0.8%;
	}
}

/* Thin strip along the top edge of a card. */
.noel-fold--strip {
	--fold-mid-at: 44%;
	--fold-warm-at: 72%;
	--fold-sliver: 0%;
	height: 6px;
}

.noel-fold--strip .noel-fold__panel {
	box-shadow: none;
}

/* Fold chip: a small three-panel mark for headings and sign-offs. */
.noel-fold--chip {
	--fold-mid-at: 34%;
	--fold-warm-at: 66%;
	--fold-sliver: 0%;
	display: inline-block;
	width: 1.1em;
	height: 1.1em;
	vertical-align: -0.12em;
	margin-right: 0.35em;
}

.noel-fold--chip .noel-fold__panel {
	box-shadow: none;
}

/* Opening motion for the sign-in screen: the panels open one after another.
 * CSS only, so the finished state shows with JavaScript off. */
@media (prefers-reduced-motion: no-preference) {
	.noel-fold--open .noel-fold__panel {
		animation: noel-fold-open 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.noel-fold--open .noel-fold__panel--mid {
		animation-delay: 0.15s;
	}

	.noel-fold--open .noel-fold__panel--warm {
		animation-delay: 0.45s;
	}
}

@keyframes noel-fold-open {
	from {
		transform: skewX(calc(var(--noel-crease-angle) * -1)) translateX(100vw);
	}
	to {
		transform: skewX(calc(var(--noel-crease-angle) * -1)) translateX(0);
	}
}
