/**
 * Cartbasket brand layer (see inc/cb-brand.php): self-hosted fonts, palette tokens, the logo lockup and its loop,
 * and the token mapping for the company, policy and order-tracking pages (og-pages.css).
 * Palette (redesign of 2026-11-16): aubergine #42243A (actions, dark surfaces), ivory #FAF7F2 (page), dusty rose
 * #E8D6D9 (alternate sections), ink #241F23 (text); the logo's rose accent is #C46F8A (#E8A3B8 on dark).
 * Type (2026-11-17): Instrument Sans everywhere, Instrument Serif only for the large Home and About headings.
 * The older token names (--cb-navy, --cb-teal, ...) are kept so earlier modules pick up the new palette.
 */

/* ------------------------------------------------------------------ fonts (fonts/, SIL OFL 1.1) */
@font-face {
	font-family: "Instrument Sans";
	src: url("../fonts/instrument-sans-latin-var.woff2") format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Instrument Sans";
	src: url("../fonts/instrument-sans-italic-latin-var.woff2") format("woff2");
	font-weight: 400 700;
	font-style: italic;
	font-display: swap;
}

@font-face {
	font-family: "Instrument Serif";
	src: url("../fonts/instrument-serif-latin.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

/* Instrument Sans has no rupee sign; this face supplies only U+20B9 (from Inter, matched cap height). */
@font-face {
	font-family: "Cartbasket Rupee";
	src: url("../fonts/cb-rupee-inter-var.woff2") format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+20B9;
}

/* While the text face loads: Arial scaled to Instrument Sans' width and line metrics, so the swap barely moves text. */
@font-face {
	font-family: "Instrument Sans Fallback";
	src: local("Arial"), local("Helvetica"), local("Liberation Sans");
	size-adjust: 100.5%;
	ascent-override: 96.5%;
	descent-override: 24.9%;
	line-gap-override: 0%;
}

:root {
	--cb-aubergine: #42243A;
	--cb-aubergine-dark: #2E1828;
	--cb-aubergine-tint: #F3ECF0;
	--cb-ivory: #FAF7F2;
	--cb-rose: #E8D6D9;
	--cb-rose-soft: #F4EAEC;
	--cb-rose-accent: #C46F8A;
	--cb-ink: #241F23;
	--cb-muted: #5E555B;
	--cb-line: #E4DAD5;
	--cb-line-strong: #CFC3C0;
	--cb-white: #FFFFFF;
	--cb-focus: #42243A;
	--cb-success: #2F6B45;
	--cb-danger: #A3262F;
	--cb-font-body: "Instrument Sans", "Cartbasket Rupee", "Instrument Sans Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--cb-font-head: var(--cb-font-body);
	--cb-font-accent: "Instrument Serif", "Cartbasket Rupee", Georgia, "Times New Roman", serif;

	/* Earlier names, now on the new palette. */
	--cb-ivory-deep: var(--cb-rose-soft);
	--cb-navy: var(--cb-ink);
	--cb-text: var(--cb-ink);
	--cb-teal: var(--cb-aubergine);
	--cb-teal-dark: var(--cb-aubergine-dark);
}

/* ------------------------------------------------------------------ logo lockup */
/* The mark keeps a fixed box (its loop is transform-only), so the wordmark, menu and search never move. */
.cb-logo {
	--cb-logo-mark: 32px;
	--cb-logo-word: 19px;
	--cb-logo-gap: 8px;
	display: inline-flex;
	align-items: center;
	gap: var(--cb-logo-gap);
	color: var(--cb-aubergine);
	line-height: 0;
	text-decoration: none;
	white-space: nowrap;
	border-radius: 6px;
	-webkit-tap-highlight-color: transparent;
}

.cb-logo:hover,
.cb-logo:focus {
	color: var(--cb-aubergine);
	text-decoration: none;
}

html body .cb-logo:focus-visible {
	outline: 2px solid var(--cb-focus);
	outline-offset: 5px;
}

.cb-logo__mark {
	display: block;
	flex: 0 0 var(--cb-logo-mark);
	width: var(--cb-logo-mark);
	height: var(--cb-logo-mark);
}

.cb-logo__mark .cb-mark {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.cb-logo__word {
	display: block;
	flex: 0 0 auto;
	width: auto;
	height: var(--cb-logo-word);
	aspect-ratio: 5104 / 752;
	margin-top: 2px;
	fill: currentColor;
	overflow: visible;
}

.cb-logo--mobile {
	--cb-logo-mark: 26px;
	--cb-logo-word: 15.5px;
	--cb-logo-gap: 6px;
}

.cb-logo--drawer {
	--cb-logo-mark: 28px;
	--cb-logo-word: 17px;
	--cb-logo-gap: 7px;
}

.cb-logo--footer {
	--cb-logo-mark: 36px;
	--cb-logo-word: 22px;
	--cb-logo-gap: 9px;
}

.cb-logo--light,
.cb-logo--light:hover,
.cb-logo--light:focus {
	color: var(--cb-ivory);
}

html body .cb-logo--light:focus-visible {
	outline-color: var(--cb-ivory);
}

/* The loop (3.6 s): the handle lifts, the basket tilts and settles, the rose accent pops, then a short rest. It runs
   only while js/cb-ui.js marks the mark .is-playing: on screen, tab visible, not paused, no reduced motion. Paused,
   hidden and reduced-motion copies show the static mark. Origins are in the 32-unit viewBox. */
.cb-mark__basket {
	transform-origin: 16px 28px;
}

.cb-mark__handle {
	transform-origin: 7.6px 14px;
}

.cb-mark__accent {
	transform-origin: 22.8px 8.66px;
}

.cb-logo__mark.is-playing .cb-mark__basket {
	animation: cb-mark-tilt 3.6s cubic-bezier(0.37, 0, 0.3, 1) infinite;
}

.cb-logo__mark.is-playing .cb-mark__handle {
	animation: cb-mark-lift 3.6s cubic-bezier(0.3, 0.7, 0.3, 1) infinite;
}

.cb-logo__mark.is-playing .cb-mark__accent {
	animation: cb-mark-accent 3.6s ease-in-out infinite;
}

@keyframes cb-mark-lift {
	0%, 6% { transform: none; }
	18%, 30% { transform: translateY(-1.9px) rotate(-7deg); }
	42% { transform: translateY(0.3px) rotate(1.5deg); }
	50%, 100% { transform: none; }
}

@keyframes cb-mark-tilt {
	0%, 12% { transform: none; }
	24% { transform: rotate(-6deg); }
	36% { transform: rotate(3.5deg); }
	46% { transform: rotate(-1.6deg); }
	54% { transform: rotate(0.6deg); }
	60%, 100% { transform: none; }
}

@keyframes cb-mark-accent {
	0%, 52% { transform: none; }
	58% { transform: translate(0.6px, -1.2px) scale(1.28); }
	64% { transform: scale(0.9); }
	70%, 100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.cb-logo__mark .cb-mark * {
		animation: none !important;
	}
}

/* ------------------------------------------------------------------ company, policy and order-tracking pages */
.og-doc {
	--og-ink: var(--cb-ink);
	--og-text: var(--cb-ink);
	--og-muted: var(--cb-muted);
	--og-line: var(--cb-line);
	--og-panel: var(--cb-white);
	--og-soft: var(--cb-rose-soft);
	--og-dark: var(--cb-aubergine);
	--og-accent: var(--cb-aubergine);
}

.og-doc .og-btn--dark:hover {
	background-color: var(--cb-aubergine-dark);
}
