/*
Message bubbles!
*/

.bubbles {
	--color-bubbles-background: light-dark(#e7e0d2, #0a0a0a);
	--color-message-bubble: light-dark(#c7ffc4, #123d29);
	--color-message-bubble-received: light-dark(#fff, #1b1d1d);
	--color-message-text: light-dark(#0f0f0f, #f6f6f6);
	--color-quoted-message: light-dark(#0d0d0d, #c3c3c3);
	--color-quoted-message-background: light-dark(#c4f4c0, #102f21);
	--color-message-reaction-background: var(--color-message-bubble-received);
	--color-message-reaction-text: light-dark(#5e5e5e, #7f7f7f);

	display: flex;
	flex-direction: column;
	padding: 1rem;
	gap: 0.5rem;
	margin: 1rem 0;
	border-radius: 0.5rem;
	background-color: var(--color-bubbles-background);
}

.bubbles--spacy {
	margin-bottom: 2.5rem;
}

.message {
	max-width: 90%;
	padding: 0.5rem;
	line-height: 1.4;
	word-wrap: break-word;
	border-radius: 0.5rem;
	position: relative;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
	position: relative; /* Necessario per posizionare la reazione in modo assoluto */
}

@media (min-width: 600px) {
	.message {
		max-width: 80%;
	}
}

@media (min-width: 700px) {
	.message {
		max-width: 70%;
	}
}

.message > p,
.quoted-message > p {
	margin-top: 0.5em;
}

.message p:first-of-type {
	margin-top: 0;
}
.message p:last-of-type {
	margin-bottom: 0;
}

.message--sent {
	align-self: flex-end;
	background-color: var(--color-message-bubble);
	color: var(--color-message-text);
	border-radius: 0.5rem 0.5rem 0 0.5rem;
}

.message--sent::after {
	content: "";
	position: absolute;
	bottom: 0;
	right: -0.5rem;
	width: 0;
	height: 0;
	border: 0.5rem solid transparent;
	border-bottom-color: var(--color-message-bubble);
	border-top: 0;
	border-left: 0;
}

.message--received {
	align-self: flex-start;
	background-color: var(--color-message-bubble-received);
	color: var(--color-message-text);
	border-radius: 0.5rem 0.5rem 0.5rem 0;
	position: relative;
}

.message--received::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: -0.5rem;
	width: 0;
	height: 0;
	border: 0.5rem solid transparent;
	border-bottom-color: var(--color-message-bubble-received);
	border-top: 0;
	border-right: 0;
}

.quoted-message {
	font-size: 90%;
	border-radius: 0.25rem;
	margin-bottom: 0.5rem;
	padding: 0.5rem;
}

/*
Sender (mittente) colors are defined just in the .message__sender--N,
which are modifier classes of the .quoted-message blocks
*/

.message--sender--1 {
	--sender-color: light-dark(#0277bd, #81d4fa);
}

.message--sender--2 {
	--sender-color: light-dark(#e65100, #ffab91);
}

.message--sender--3 {
	--sender-color: light-dark(#ff7043, #ffccbc);
}

.message--sender--4 {
	--sender-color: light-dark(#2e7d32, #a5d6a7);
}

.message--sender--5 {
	--sender-color: light-dark(#8e24aa, #e1bee7);
}

.message--sender--6 {
	--sender-color: light-dark(#d32f2f, #ef9a9a);
}

.message--sender--7 {
	--sender-color: light-dark(#1976d2, #90caf9);
}

.message--sender--8 {
	--sender-color: light-dark(#388e3c, #a5d6a7);
}

.message--sender--9 {
	--sender-color: light-dark(#fbc02d, #fff176);
}

.message--sent > .quoted-message {
	background-color: var(--color-quoted-message-background);
	border-left: 4px solid var(--sender-color);
	color: var(--color-quoted-message);
}

.message__sender {
	display: block;
	font-weight: bold;
	font-size: 90%;
	color: var(--sender-color);
}

/* Polls */

.poll {
	--poll-type-description-color: light-dark(#566c54, #779789);
	--poll-option-accent-color: light-dark(#1f9d4e, #24b750);
	--poll-option-stroke: var(--poll-type-description-color);
	--poll-bar-background-color: light-dark(#96c294, #224e3a);
}

.poll__title {
	font-weight: 700;
}

.poll__type-description {
	font-size: 90%;
	color: var(--poll-type-description-color);
}

.poll__type-description svg,
.poll__type-description use {
	fill: var(--poll-type-description-color);
}

.poll__options {
	fill: var(--poll-option-accent-color);
	list-style-type: none;
	padding-left: 0;
}

.poll__option {
	display: grid;
	grid-template-areas:
		"icon text users-count"
		"icon bar bar";
	grid-template-columns: auto 1fr auto;
	gap: 0.5rem; /* Spacing between elements */
	align-items: center;
	margin-bottom: 1rem;
}

.poll__option__icon {
	grid-area: icon;
	align-self: start;
}

#poll-option-empty {
	stroke: var(--poll-option-stroke);
}

.poll__option__text {
	grid-area: text;
}

.poll__option__users-count {
	grid-area: users-count;
	display: flex; /* Allows icons and count to align horizontally */
	align-items: center; /* Vertically aligns icons and count */
	gap: 0.25rem; /* Adds spacing between icons and the count */
}

.poll__option__bar {
	grid-area: bar;
	align-self: end;
	background-color: var(--poll-bar-background-color);
	height: 10px;
	border-radius: 0.5rem;
}

.poll__option__bar__value {
	background-color: var(--poll-option-accent-color);
	height: 10px;
	border-radius: 0.5rem;
	width: 50%;
}

.poll__show-votes {
	border-top: 1px solid var(--poll-bar-background-color);
	padding-top: 0.5rem;
	margin-top: 1.5rem;
	margin-left: -0.5rem;
	margin-right: -0.5rem;
	font-size: 90%;
	color: var(--poll-option-accent-color);
	text-align: center;
}

/* Reactions */
.message__reaction {
	position: absolute;
	min-width: 2.25rem;
	bottom: -1.25rem;
	background-color: var(--color-message-reaction-background);
	color: var(--color-message-reaction-text);
	border-radius: 1rem;
	border: 1px solid light-dark(#f3efe6, #0a0a0a);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	text-align: center;
	padding: 0 .5rem;
	font-size: 90%;
}

.message__reaction__emojis {
	margin-right: .3rem;
}

.message__reaction__count {
	font-size: 85%;
}

.message--sent > .message__reaction {
	right: 0.5rem;
}

.message--received > .message__reaction {
	left: 0.5rem;
}

.message:has(.message__reaction) {
	margin-bottom: 1.2rem;
}
/* Defaults */
:root {
	color-scheme: light dark;
	--font-family-serif: Georgia, serif;
	--font-family-sans: -apple-system, system-ui, sans-serif;
	--font-family-monospace: Consolas, Menlo, Monaco, Andale Mono WT, Andale Mono,
		Lucida Console, Lucida Sans Typewriter, DejaVu Sans Mono,
		Bitstream Vera Sans Mono, Liberation Mono, Nimbus Mono L, Courier New,
		Courier, monospace;
}

/* Theme colors */
:root {
	--color-gray-50: #c0c0c0;
	--color-header-footer-border: light-dark(#e0e0e0, #000);
	--color-header-footer-background: light-dark(#f4f7f4, #192537);
	--color-whatsapp-green: #25d366;
	--color-whatsapp-green-darker: #11863b;

	--background-color: light-dark(#fff, #15202b);
	--text-color: light-dark(#333, #dad8d8);
	--text-color-link: light-dark(
		var(--color-whatsapp-green-darker),
		var(--color-whatsapp-green)
	);
	--text-color-link-active: var(--text-color-link);
	--text-color-link-visited: var(--text-color-link);
	--text-color-link-decoration: light-dark(#9cc59c, #192537);
	--syntax-tab-size: 2;
}

/* Global stylesheet */
* {
	box-sizing: border-box;
}

@view-transition {
	navigation: auto;
}

html,
body {
	height: 100%;
	margin: 0;
	padding: 0;
	font-family: var(--font-family-sans);
	color: var(--text-color);
	background-color: var(--background-color);
	font-size: 110%;
	scroll-behavior: smooth;
}
html {
	overflow-y: scroll;
}
body {
	display: flex;
	flex-direction: column;
	min-height: 100vh; /* Ensures the body is at least the height of the viewport */
}

heading-anchors {
	display: contents;
}

main,
.header__inner,
.footer__inner {
	max-width: 40em;
	margin: 0 auto;
}

main {
	flex: 1;
}

/* https://www.a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* Fluid images via https://www.zachleat.com/web/fluid-images/ */
img {
	max-width: 100%;
}
img[width][height] {
	height: auto;
}
img[src$=".svg"] {
	width: 100%;
	height: auto;
	max-width: none;
}

p:last-child {
	margin-bottom: 0;
}
p {
	line-height: 1.5;
}

ul {
	padding-left: 0.9rem;
}

ul > li {
	padding-inline-start: 0.25rem;
}

ol {
	padding-left: 1.1rem;
}

ol > li {
	padding-inline-start: 0.5rem;
}

li {
	line-height: 1.5;
	margin-bottom: 0.5em;
}
.toc li {
	margin-bottom: 0.25em;
}

a[href] {
	color: var(--text-color-link);
	text-underline-position: from-font;
	text-underline-offset: -1px;
	text-decoration-thickness: 2px;
	text-decoration-color: var(--text-color-link-decoration);
}
a[href]:visited {
	color: var(--text-color-link-visited);
}
a[href]:hover,
a[href]:active {
	color: var(--text-color-link-active);
}

main,
footer {
	padding: 1rem;
}


main p,
main li {
	hyphens: auto;
}

.links-nextprev {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	list-style: "";
	padding: 0;
}
.links-nextprev > * {
	flex-grow: 1;
	padding-inline-start: 0;
}
.links-nextprev-next {
	text-align: right;
}

table {
	margin: 1em 0;
}
table td,
table th {
	padding-right: 1em;
}

pre,
code {
	font-family: var(--font-family-monospace);
}
pre:not([class*="language-"]) {
	margin: 0.5em 0;
	line-height: 1.375; /* 22px /16 */
	-moz-tab-size: var(--syntax-tab-size);
	-o-tab-size: var(--syntax-tab-size);
	tab-size: var(--syntax-tab-size);
	-webkit-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
	direction: ltr;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	overflow-x: auto;
}
code {
	word-break: break-all;
}

/* Header */
header {
	border-bottom: 1px dashed var(--color-header-footer-border);
	background-color: var(--color-header-footer-background);
}
.header__inner {
	padding: 1em;
	display: flex;
	flex-direction: column;
	gap: 0.5em;
	flex-wrap: wrap;
	align-items: start;
}

.home-link {
	width: 100%;
	display: flex;

	gap: 0.75rem;
	align-items: center;
	font-size: 1.25rem;
	font-weight: 700;
	margin-right: 1rem;
}
.home-link[href],
.home-link[href]:visited {
	-color: var(--text-color);
}
.home-link:link:not(:hover) {
	text-decoration-line: none;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
	font-weight: 700;
	font-family: var(--font-family-serif);
}

h1 {
	margin-top: 2rem;
	margin-bottom: 1.5rem;
}
h1:first-child {
	margin-top: 0;
}

h2 {
	margin-top: 3rem;
}

h3 {
	margin-top: 2.5rem;
	line-height: 130%;
}

/* Nav */
.main-nav {
	display: inline-flex;
	flex-wrap: wrap;
	padding: 0;
	margin: 0 -0.5rem;
	list-style: none;
	font-size: 90%;
}
@media (min-width: 425px) {
	.main-nav {
		font-size: inherit;
	}
}
.main-nav > ul,
.main-nav > ul > li {
	display: contents;
}

.main-nav--link {
	padding: 0.5rem;
}
@media (min-width: 450px) {
	.main-nav {
		margin: 0 -0.75rem;
	}
	.main-nav--link {
		padding: 0.5rem 0.75rem;
	}
}
.main-nav--link[href]:not(:hover) {
	text-decoration-line: none;
}
.main-nav--link[href][aria-current="page"] {
	text-decoration-line: underline;
}

/* Required for CSS sprites as they're shadow DOM */
symbol {
	fill: inherit;
	stroke: inherit;
}

.link__emoji {
	margin-right: 0.25rem;
}

.button--cta,
.link--cta {
	--gradient-color-top: light-dark(#2ecc71, #1c7a4f);
	--gradient-color-bottom: light-dark(#27ae60, #145c3d);

	background: linear-gradient(
		to bottom,
		var(--gradient-color-top),
		var(--gradient-color-bottom)
	);

	padding: 0.5rem 1.25rem 0.5rem 1rem;
	border-radius: 0.375rem;

	/* Border using light-dark for a suitable dark green in dark mode */
	border: 1px solid light-dark(#1e824c, #0f4d2d);

	display: inline-flex;
	align-items: start;
	gap: 0.4rem;
	margin-top: 1rem;

	font-weight: 500;
	text-decoration-line: none;

	box-shadow: 0 1px 2px light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.5));
}

.button--cta:hover,
.link--cta:hover {
	--gradient-color-top: light-dark(#30d778, #22934f);
	--gradient-color-bottom: light-dark(#1a6f41, #105030);
	border-color: light-dark(#1a6f41, #105030);
	box-shadow: 0 2px 4px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.6));
}

.button--cta:active,
.link--cta:active {
	/* Pressed state: uniform gradient in both modes */
	--gradient-color-top: light-dark(#27ae60, #27ae60);
	--gradient-color-bottom: light-dark(#145c3d, #145c3d);
	border-color: light-dark(#196437, #0f3d24);
	box-shadow: inset 0 1px 3px
		light-dark(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.7));
}

.button--cta,
.link--cta__text {
	color: #fff; /* White in both modes */
	font-size: inherit
}

.noShare #shareBtn {
  display: none;
}


/* Closing, pre-footer */

.page-closing {
	border-top: 1px dashed var(--color-header-footer-border);
	margin-top: 2.5rem;
}


/* Footer */

footer {
	margin-top: 1rem;
	border-top: 1px dashed var(--color-header-footer-border);
	background-color: var(--color-header-footer-background);
	font-size: 90%;
}

.footer__inner {
	padding: 1rem 1rem;
	display: flex;
	justify-content: space-between;
	flex-direction: column;
	align-items: end;
	gap: 1rem;
}

@media (min-width: 425px) {
	footer {
		font-size: inherit;
	}
}

@media (min-width: 690px) {
	.footer__inner {
		flex-direction: row;
		justify-content: space-between;
	}
}