/* ────────────────────────────────────────────────────────────
   Tema del blog: fosc per defecte (estil manton.org), clar opcional.
   L'usuari tria amb el botó ☀/☾ de la capçalera; la tria es
   guarda a localStorage. Les dues paletes es defineixen amb
   variables CSS: :root = fosc, :root[data-theme="light"] = clar.
   ──────────────────────────────────────────────────────────── */

:root {
	--bg:            #151414;
	--fg:            #E5E9EC;
	--fg-strong:     #E5E9EC;
	--muted:         #90A3CA;
	--link:          #B8C3CC;
	--link-hover:    #E5E9EC;
	--nav-bg:        #2A2828;
	--nav-fg:        #90A3CA;
	--nav-hover:     #B8C3CC;
	--title-fg:      #E5E9EC;
	--border:        #2B343B;
	--code-bg:       #2A2A2A;
	--code-fg:       #FFF;
	--accent:        #E3B341;
	--accent-hover:  #F2C65A;
	--post-nav-fg:   #CFD2B2;
	--post-nav-hover:#E5E9EC;
	--table-odd-bg:  #000;
	--toggle-hover-bg: rgba(255,255,255,0.08);
}

:root[data-theme="light"] {
	--bg:            #FAF9F6;
	--fg:            #3A3A38;
	--fg-strong:     #262624;
	--muted:         #6E6A63;
	--link:          #55524B;
	--link-hover:    #1F1E1B;
	--nav-bg:        #F1EEE8;
	--nav-fg:        #55524B;
	--nav-hover:     #1F1E1B;
	--title-fg:      #262624;
	--border:        #E0DCD3;
	--code-bg:       #EFECE4;
	--code-fg:       #2F2E2B;
	--accent:        #8A5A00;
	--accent-hover:  #6B4500;
	--post-nav-fg:   #6B5A1E;
	--post-nav-hover:#8A5A00;
	--table-odd-bg:  #F1EEE7;
	--toggle-hover-bg: rgba(0,0,0,0.05);
}

/* GENERAL */

body {
	color: var(--fg);
	background: var(--bg);
	transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3 {
	color: var(--fg-strong);
}

a, p a, ul a, ol a {
	color: var(--link);
	transition: none !important;
	box-shadow: none !important;
}

a:hover, p a:hover, ul a:hover, ol a:hover {
	color: var(--link-hover);
}

b, strong {
	color: var(--link);
}

span.divider {
	background-color: var(--border);
}

/* NAVIGATION (capçalera centrada i recollida) */

nav.main-nav {
	background: var(--nav-bg);
	border-bottom: 1px solid var(--border);
	padding: 12px 20px;
	position: sticky;
	top: 0;
	z-index: 100;
	text-align: center;
}

.nav-inner {
	max-width: 600px;           /* mateix ample que el contingut */
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;  /* nom a l'esquerra, pestanyes a la dreta */
	flex-wrap: wrap;
	gap: 10px 28px;
}

nav.main-nav a {
	color: var(--nav-fg);
	transition: none !important;
	box-shadow: none !important;
}

nav.main-nav a:hover {
	color: var(--nav-hover);
}

.site-title {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 0;
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 2px;
}

.site-title img {
	border-radius: 50%;
	object-fit: cover;
	width: 40px;
	height: 40px;
}

.site-title a {
	color: var(--title-fg);
}

/* Avatars (barra i post-meta) sense distorsió */
#post-meta img.avatar {
	object-fit: cover;
	border-radius: 50%;
}

.site-menus {
	display: flex;
	align-items: center;
	gap: 22px;
	font-size: 15px;
}

.nav-toggle {
	display: none;
	background: none;
	border: 0;
	color: var(--nav-fg);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 6px 8px;
}

/* Botó de tema (clar/fosc) */

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--border);
	background: transparent;
	color: var(--nav-fg);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
	color: var(--nav-hover);
	border-color: var(--nav-hover);
	background: var(--toggle-hover-bg);
}

.theme-toggle svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* En clar mostrem la lluna (el que activaràs); en fosc, el sol */
.theme-toggle .icon-sun   { display: none; }
.theme-toggle .icon-moon  { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Mòbil: capçalera centrada, menú darrere l'hamburguesa */
@media only screen and (max-width: 750px) {
	nav.main-nav {
		padding: 10px 16px;
		position: relative;
	}

	.nav-inner {
		flex-direction: column;
		justify-content: center;
		align-items: flex-start;
		gap: 8px;
	}

	.nav-toggle {
		display: block;
		position: absolute;
		right: 14px;
		top: 50%;
		transform: translateY(-50%);
	}

	.theme-toggle {
		position: absolute;
		right: 56px;
		top: 50%;
		transform: translateY(-50%);
		width: 32px;
		height: 32px;
	}

	.site-title {
		font-size: 15px;
		letter-spacing: 1.5px;
	}

	.site-title img {
		width: 34px;
		height: 34px;
	}

	.site-menus {
		display: none;
		flex-direction: column;
		align-items: center;
		gap: 14px;
		width: 100%;
		padding: 4px 0 2px;
		font-size: 14px;
	}

	.site-menus.open {
		display: flex;
	}

	.site-menus a {
		padding: 6px 12px;
	}
}

/* POST */

#post-nav a {
	transition: none !important;
	box-shadow: none !important;
}

#post-meta div span.dark {
	color: var(--post-nav-fg);
}

#post-meta div a {
	color: var(--nav-fg);
}

#post-meta div a:hover {
	color: var(--fg);
}

#post-nav a {
	color: var(--post-nav-fg);
	font-weight: bold;
}

#post-nav a:hover {
	color: var(--post-nav-hover);
}

#post-meta {
	border-color: var(--border) !important;
}

.dates {
	color: var(--muted);
}

.dates:hover {
	color: var(--fg);
}

/* FOOTER */

footer .social {
	display: flex;
	gap: 18px;
	justify-content: center;
	margin-bottom: 14px;
}

footer .social a {
	font-size: 14px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

footer .social svg {
	width: 16px;
	height: 16px;
}

.rss-link {
	text-align: center;
	margin-top: 20px;
	font-size: 14px;
}

.rss-link a {
	color: var(--nav-fg);
}

.rss-link a:hover {
	color: var(--fg);
}

#footer a {
	transition: none !important;
	box-shadow: none !important;
	color: var(--nav-fg);
}

#footer a:hover {
	color: var(--fg);
}

/* CODI I CONTINGUT */

pre {
	background-color: var(--code-bg);
	color: var(--code-fg);
}

code {
	background-color: var(--code-bg);
}

tr:nth-child(odd)>td {
	background: var(--table-odd-bg);
}

.e-content p a {
	text-decoration: underline !important;
}

/* Enllaços dins del cos del text: ambre perquè destaquin */
.e-content a {
	color: var(--accent);
}

.e-content a:hover {
	color: var(--accent-hover);
}

/* PÀGINA SOBRE MI */

.about-photo {
	margin: 4px auto 32px;
	width: 100%;
}

.about-photo img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.about-photo figcaption {
	margin-top: 6px;
	font-size: 13px;
	color: var(--muted);
	text-align: left;
	line-height: 1.5;
}

.about-photo figcaption a {
	color: var(--accent);
}

/* Pàgines estàtiques (Sobre mi, Ara): títol alineat amb el text */
.post.page header {
	text-align: left;
}

.contact-list {
	list-style: none;
	padding: 0;
	margin-top: 0.5em;
}

.contact-list li {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin: 12px 0;
}

.contact-list svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
	flex-shrink: 0;
}

.contact-list svg.stroke {
	fill: none;
}

.contact-list a {
	color: var(--nav-fg);
	font-weight: 600;
}

.contact-list a:hover {
	color: var(--nav-hover);
}

.contact-list .note {
	color: var(--muted);
	font-size: 14px;
}

.contact-list li.contact-group {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: var(--muted);
	margin: 18px 0 2px;
}

/* ARXIU: núvol d'etiquetes */

.tag-cloud {
	margin: 0 0 2.5em;
}

.tag-cloud-title {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: var(--muted);
	margin-bottom: 14px;
}

.tag-cloud-items {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 10px 18px;
}

.tag-cloud a {
	color: var(--accent);
	text-decoration: none;
	box-shadow: none !important;
	transition: none !important;
}

.tag-cloud a:hover {
	color: var(--accent-hover);
}

.tag-cloud .tag-count {
	color: var(--muted);
	font-size: 12px;
	margin-left: 4px;
}

.tag-cloud .tag-xl { font-size: 22px; }
.tag-cloud .tag-lg { font-size: 18px; }
.tag-cloud .tag-md { font-size: 15px; }
