/* 112 Books — Formulari guiat «Parlem del teu projecte»
 * Pop-up no invasiu + wizard modular. Identitat visual de 112books.eu.
 * Mòbil primer · Accessible (focus visible, contrast AA) · Sense dependències.
 */

/* ── Utilitats ─────────────────────────────────────────────────── */
.b112-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}
.b112-wizard[hidden],
.b112-teaser[hidden],
.b112-dock[hidden] { display: none !important; }

html.b112-modal-open,
html.b112-modal-open body { overflow: hidden; }

.b112-wizard,
.b112-teaser,
.b112-dock {
	--b112-ink: #211D1B;
	--b112-accent: #D51F17;
	--b112-accent-dark: #b01810;
	--b112-surface: #F4F4F1;
	--b112-muted: #6F6863;
	--b112-border: #D9D6D1;
	--b112-bg: #FFFFFF;
	--b112-deep: #292624;
	font-family: Verdana, Geneva, sans-serif;
	color: var(--b112-ink);
}

/* Botons genèrics del formulari */
.b112-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 0.88rem;
	font-weight: 700;
	line-height: 1.2;
	border-radius: 999px;
	padding: 0.7rem 1.5rem;
	border: 1.5px solid transparent;
	cursor: pointer;
	transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
	min-height: 46px;
	text-decoration: none;
}
.b112-btn-primary {
	background: #211D1B;
	color: #FFFAF0;
	border-color: #211D1B;
}
.b112-btn-primary:hover { background: #D51F17; border-color: #D51F17; color: #fff; transform: translateY(-2px); }
.b112-btn-primary:disabled { opacity: .55; cursor: default; transform: none; }
.b112-btn-ghost {
	background: transparent;
	color: #211D1B;
	border-color: rgba(33, 29, 27, 0.28);
}
.b112-btn-ghost:hover { border-color: #D51F17; color: #D51F17; transform: translateY(-2px); }
.b112-btn-danger { color: var(--b112-accent, #D51F17); border-color: transparent; }
.b112-btn-danger:hover { text-decoration: underline; }
.b112-wizard :focus-visible,
.b112-teaser :focus-visible,
.b112-dock:focus-visible {
	outline: 3px solid var(--b112-accent, #D51F17);
	outline-offset: 2px;
	border-radius: 6px;
}

/* ── Teaser (pop-up no invasiu) ────────────────────────────────── */
.b112-teaser {
	position: fixed;
	top: 50%;
	left: 50%;
	z-index: 99997;
	width: min(420px, calc(100vw - 32px));
	background: #F4F4F1;
	border: 1px solid rgba(33, 29, 27, 0.14);
	border-radius: 18px;
	box-shadow: 0 28px 60px rgba(33, 29, 27, 0.22);
	padding: 22px 22px 20px;
	transform: translate(-50%, -160vh);
	opacity: 0;
	transition: transform .62s cubic-bezier(.22, .85, .3, 1), opacity .45s ease;
	will-change: transform, opacity;
}
.b112-teaser.is-in { transform: translate(-50%, -50%); opacity: 1; }
.b112-teaser.is-out { transform: translate(-50%, 160vh); opacity: 0; }
.b112-teaser-close {
	position: absolute;
	top: 10px; right: 12px;
	width: 34px; height: 34px;
	border: none; background: transparent;
	font-size: 22px; line-height: 1;
	color: var(--b112-muted, #6F6863);
	cursor: pointer;
	border-radius: 999px;
}
.b112-teaser-close:hover { color: var(--b112-ink, #211D1B); background: var(--b112-surface, #F4F4F1); }
.b112-teaser-kicker {
	margin: 0 0 8px;
	font-size: 0.82rem;
	font-weight: 700;
	color: #D51F17;
}
.b112-teaser h2 {
	font-family: Georgia, serif;
	font-size: 23px;
	line-height: 1.05;
	letter-spacing: -0.02em;
	margin: 0 0 10px;
}
.b112-teaser p {
	font-size: 13px;
	line-height: 1.55;
	color: var(--b112-muted, #6F6863);
	margin: 0 0 16px;
}
.b112-teaser-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Dock (botó per tornar a obrir) ────────────────────────────── */
.b112-dock {
	position: fixed;
	bottom: 22px;
	left: 50%;
	z-index: 99990;
	transform: translate(-50%, 180%);
	transition: transform .45s cubic-bezier(.22, .85, .3, 1);
	display: inline-flex;
	align-items: center;
	gap: 9px;
	background: #211D1B;
	color: #F4F4F1;
	border: none;
	border-radius: 999px;
	padding: 12px 20px;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12.5px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(33, 29, 27, .28);
}
.b112-dock.is-in { transform: translate(-50%, 0); }
.b112-dock:hover { background: #000; }
.b112-dock-dot {
	width: 9px; height: 9px;
	border-radius: 50%;
	background: var(--b112-accent, #D51F17);
	box-shadow: 0 0 0 4px rgba(213, 31, 23, .18);
}

/* ── Wizard (modal) ────────────────────────────────────────────── */
.b112-wizard {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px;
}
.b112-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(33, 29, 27, .55);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}
.b112-dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(680px, 100%);
	max-height: min(92vh, 900px);
	background: var(--b112-bg, #fff);
	border-radius: 18px;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
	overflow: hidden;
	animation: b112-pop .28s cubic-bezier(.22, .85, .3, 1);
}
@keyframes b112-pop {
	from { transform: translateY(14px) scale(.985); opacity: 0; }
	to { transform: none; opacity: 1; }
}
.b112-dialog-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px 6px 22px;
}
.b112-dialog-brand {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--b112-accent, #D51F17);
}
.b112-dialog-close {
	width: 40px; height: 40px;
	border: none;
	background: transparent;
	border-radius: 999px;
	font-size: 26px;
	line-height: 1;
	color: var(--b112-muted, #6F6863);
	cursor: pointer;
}
.b112-dialog-close:hover { background: var(--b112-surface, #F4F4F1); color: var(--b112-ink, #211D1B); }

.b112-progress { padding: 4px 22px 12px; }
.b112-progress-text {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 11px;
	font-weight: 700;
	color: var(--b112-muted, #6F6863);
	margin-bottom: 7px;
}
.b112-progress-title { text-align: right; color: var(--b112-ink, #211D1B); }
.b112-progress-track {
	height: 6px;
	background: var(--b112-surface, #F4F4F1);
	border-radius: 999px;
	overflow: hidden;
}
.b112-progress-fill {
	display: block;
	height: 100%;
	background: var(--b112-accent, #D51F17);
	border-radius: 999px;
	transition: width .3s ease;
}

.b112-step {
	overflow-y: auto;
	padding: 4px 22px 8px;
	flex: 1 1 auto;
	-webkit-overflow-scrolling: touch;
}
.b112-step-title {
	font-family: Georgia, serif;
	font-size: 25px;
	line-height: 1.1;
	margin: 2px 0 12px;
}
.b112-step-welcome .b112-step-title { font-size: 29px; }
.b112-step-inner > p { margin: 0 0 12px; }
.b112-step-intro { color: var(--b112-muted, #6F6863); font-size: 14px; line-height: 1.55; }
.b112-note {
	background: var(--b112-surface, #F4F4F1);
	border-left: 3px solid var(--b112-accent, #D51F17);
	border-radius: 0 8px 8px 0;
	padding: 10px 14px;
	font-size: 12.5px !important;
	color: var(--b112-muted, #6F6863) !important;
}
.b112-help {
	background: var(--b112-surface, #F4F4F1);
	border-radius: 12px;
	padding: 12px 15px;
	margin: 0 0 14px;
}
.b112-help p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.55; color: var(--b112-muted, #6F6863); }
.b112-help p:last-child { margin-bottom: 0; }
.b112-help-cond { border: 1px dashed var(--b112-border, #D9D6D1); }
.b112-module-link {
	display: inline-block;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--b112-accent, #D51F17);
	margin: 0 0 14px;
}

/* Etiquetes i camps */
.b112-q { margin: 0 0 20px; }
.b112-q-label {
	display: block;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 13.5px;
	font-weight: 700;
	margin: 0 0 7px;
	color: var(--b112-ink, #211D1B);
}
.b112-q-help { font-size: 12px; color: var(--b112-muted, #6F6863); margin: -3px 0 8px; }
.b112-req { color: var(--b112-accent, #D51F17); }
.b112-wizard input[type="text"],
.b112-wizard input[type="email"],
.b112-wizard input[type="tel"],
.b112-wizard input[type="url"],
.b112-wizard input[type="number"],
.b112-wizard input[type="date"],
.b112-wizard textarea {
	width: 100%;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 14px;
	color: var(--b112-ink, #211D1B);
	background: #fff;
	border: 1.5px solid var(--b112-border, #D9D6D1);
	border-radius: 10px;
	padding: 11px 13px;
	min-height: 46px;
}
.b112-wizard textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.b112-wizard input[type="file"] {
	width: 100%;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12.5px;
	padding: 10px 0;
}
.b112-wizard input:focus,
.b112-wizard textarea:focus {
	border-color: var(--b112-accent, #D51F17);
	outline: 2px solid rgba(213, 31, 23, .28);
	outline-offset: 1px;
}
.b112-url { margin-top: 8px; }
.b112-file-name { font-size: 12px; color: var(--b112-muted, #6F6863); margin: 6px 0 0; }
.b112-counter { font-size: 11px; color: var(--b112-muted, #6F6863); margin: 5px 0 0; text-align: right; }

/* Opcions (radio / checkbox) */
.b112-options { display: flex; flex-direction: column; gap: 8px; }
.b112-opt {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	border: 1.5px solid var(--b112-border, #D9D6D1);
	border-radius: 12px;
	padding: 11px 13px;
	font-size: 13.5px;
	line-height: 1.45;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}
.b112-opt:hover { border-color: var(--b112-muted, #6F6863); }
.b112-opt:has(input:checked) {
	border-color: var(--b112-accent, #D51F17);
	background: rgba(213, 31, 23, .05);
}
.b112-opt input { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--b112-accent, #D51F17); }
.b112-opt span { flex: 1 1 auto; }
.b112-opt-check { align-items: flex-start; }
.b112-opt-check a { text-decoration: underline; color: var(--b112-accent, #D51F17); }
.b112-inline-text { margin: -2px 0 4px 30px; }
.b112-inline-text input { max-width: 320px; }

/* Botó per afegir mòdul (suggeriment) */
.b112-suggestion {
	margin: 6px 0 4px;
	padding: 14px;
	border: 1px dashed var(--b112-accent, #D51F17);
	border-radius: 12px;
	background: rgba(213, 31, 23, .04);
}
.b112-suggestion p { margin: 0 0 10px; font-size: 13px; }
.b112-suggestion-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Catàleg de mòduls ─────────────────────────────────────────── */
.b112-shortcuts { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 18px; }
.b112-catalog-group { margin-bottom: 20px; }
.b112-catalog-group > h3 {
	font-family: Georgia, serif;
	font-size: 16px;
	margin: 0 0 10px;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--b112-border, #D9D6D1);
}
.b112-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.b112-card {
	position: relative;
	display: flex;
	gap: 12px;
	border: 1.5px solid var(--b112-border, #D9D6D1);
	border-radius: 14px;
	padding: 13px;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.b112-card:hover { border-color: var(--b112-muted, #6F6863); }
.b112-card.is-checked {
	border-color: var(--b112-accent, #D51F17);
	background: rgba(213, 31, 23, .05);
	box-shadow: 0 4px 14px rgba(213, 31, 23, .08);
}
.b112-card-icon {
	flex: 0 0 auto;
	width: 38px; height: 38px;
	display: grid; place-items: center;
	background: var(--b112-surface, #F4F4F1);
	border-radius: 10px;
	color: var(--b112-ink, #211D1B);
}
.b112-card-icon svg { width: 22px; height: 22px; }
.b112-card-body { display: block; flex: 1 1 auto; min-width: 0; }
.b112-card-test {
	position: absolute;
	top: 10px; right: 12px;
	font-weight: 700;
	color: var(--b112-accent, #D51F17);
	font-size: 15px;
}
.b112-card-title {
	display: block;
	font-family: Georgia, serif;
	font-size: 16px;
	line-height: 1.15;
	margin: 0 26px 5px 0;
}
.b112-card-help {
	display: block;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--b112-muted, #6F6863);
}
.b112-card-actions { display: block; margin-top: 8px; }
.b112-card-link { font-size: 11.5px; font-weight: 700; color: var(--b112-accent, #D51F17); }

/* ── Resum ─────────────────────────────────────────────────────── */
.b112-summary-group { margin-bottom: 20px; }
.b112-summary-head,
.b112-summary-module-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}
.b112-summary-head h3 { font-family: Georgia, serif; font-size: 17px; margin: 0; }
.b112-summary-module {
	border: 1px solid var(--b112-border, #D9D6D1);
	border-radius: 12px;
	padding: 12px 14px;
	margin-bottom: 10px;
}
.b112-summary-module-head h4 { font-family: Georgia, serif; font-size: 15px; margin: 0; }
.b112-summary-module-tools { display: flex; gap: 12px; flex-wrap: wrap; }
.b112-link-btn {
	background: none;
	border: none;
	padding: 0;
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
	font-weight: 700;
	color: var(--b112-accent, #D51F17);
	cursor: pointer;
	text-decoration: underline;
}
.b112-link-btn:hover { color: var(--b112-accent-dark, #b01810); }
.b112-link-danger { color: var(--b112-muted, #6F6863); }
.b112-link-danger:hover { color: var(--b112-accent, #D51F17); }
.b112-summary-list { margin: 0; }
.b112-summary-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2px;
	padding: 7px 0;
	border-bottom: 1px dashed var(--b112-border, #D9D6D1);
}
.b112-summary-row:last-child { border-bottom: none; }
.b112-summary-row dt { font-size: 11.5px; font-weight: 700; color: var(--b112-muted, #6F6863); }
.b112-summary-row dd { margin: 0; font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.b112-empty { color: var(--b112-muted, #6F6863); font-size: 13px; }

/* ── Error i peu ───────────────────────────────────────────────── */
.b112-error {
	margin: 0;
	padding: 10px 22px;
	background: #FBEAE9;
	border-top: 1px solid #F1C9C6;
	color: #8A1710;
	font-size: 12.5px;
}
.b112-error ul { margin: 0; padding-left: 18px; }
.b112-error:focus { outline: none; }
.b112-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 22px 18px;
	border-top: 1px solid var(--b112-surface, #F4F4F1);
	background: #fff;
}
.b112-footer-left, .b112-footer-right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Confirmació ───────────────────────────────────────────────── */
.b112-confirm { text-align: center; padding: 14px 6px 6px; }
.b112-confirm-icon {
	width: 58px; height: 58px;
	margin: 0 auto 14px;
	display: grid; place-items: center;
	background: rgba(213, 31, 23, .1);
	color: var(--b112-accent, #D51F17);
	border-radius: 50%;
	font-size: 28px; font-weight: 700;
}
.b112-confirm h2 { font-family: Georgia, serif; font-size: 25px; margin: 0 0 10px; }
.b112-confirm p { font-size: 14px; line-height: 1.55; color: var(--b112-muted, #6F6863); margin: 0 auto 18px; max-width: 46ch; }
.b112-confirm-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.b112-confirm-links a { text-decoration: none; }

/* ── Mode pàgina normal (sense modal) ──────────────────────────── */
.b112-inline {
	max-width: 720px;
	margin: 0 auto 60px;
}
.b112-inline-card {
	background: #fff;
	border: 1px solid rgba(33, 29, 27, 0.12);
	border-radius: 18px;
	box-shadow: 0 16px 45px rgba(33, 29, 27, 0.06);
	overflow: hidden;
}
.b112-inline .b112-progress { padding: 20px 26px 12px; }
.b112-inline .b112-step { overflow: visible; padding: 4px 26px 10px; }
.b112-inline .b112-footer { padding: 16px 26px 22px; }

/* ── Escriptori ────────────────────────────────────────────────── */
@media (min-width: 560px) {
	.b112-cards { grid-template-columns: 1fr 1fr; }
	.b112-summary-row { grid-template-columns: 190px 1fr; gap: 12px; align-items: baseline; }
	.b112-step { padding: 4px 26px 10px; }
	.b112-progress { padding: 4px 26px 12px; }
	.b112-footer { padding: 16px 26px 20px; }
}

/* ── Mòbil ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
	.b112-wizard { padding: 0; align-items: stretch; }
	.b112-dialog { max-height: 100vh; border-radius: 0; }
	.b112-teaser { width: calc(100vw - 20px); }
	.b112-teaser-actions .b112-btn { flex: 1 1 auto; }
	.b112-dock { font-size: 12px; padding: 11px 16px; bottom: 16px; }
	.b112-footer { flex-direction: column-reverse; align-items: stretch; }
	.b112-footer-left, .b112-footer-right { width: 100%; }
	.b112-footer .b112-btn { flex: 1 1 auto; }
	.b112-inline-text { margin-left: 0; }
	.b112-inline-text input { max-width: 100%; }
	.b112-inline { margin: 0 auto 40px; }
	.b112-inline .b112-progress { padding: 16px 18px 10px; }
	.b112-inline .b112-step { padding: 4px 18px 8px; }
	.b112-inline .b112-footer { padding: 14px 18px 18px; }
}

/* ── Moviment reduït ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.b112-teaser, .b112-dock, .b112-dialog, .b112-progress-fill, .b112-btn { transition: none !important; animation: none !important; }
	.b112-teaser { transform: translate(-50%, -50%); }
	.b112-teaser.is-out { transform: translate(-50%, -50%); opacity: 0; }
	.b112-dock.is-in { transform: translate(-50%, 0); }
}
